Search in sources :

Example 1 with ReactiveRedisTemplate

use of org.springframework.data.redis.core.ReactiveRedisTemplate in project spring-session by spring-projects.

the class IndexDocTests method newReactiveRedisOperationsSessionRepository.

@Test
@SuppressWarnings("unused")
public void newReactiveRedisOperationsSessionRepository() {
    LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory();
    RedisSerializationContext<String, Object> serializationContext = RedisSerializationContext.<String, Object>newSerializationContext(new JdkSerializationRedisSerializer()).build();
    // tag::new-reactiveredisoperationssessionrepository[]
    // ... create and configure connectionFactory and serializationContext ...
    ReactiveRedisTemplate<String, Object> redisTemplate = new ReactiveRedisTemplate<>(connectionFactory, serializationContext);
    ReactiveSessionRepository<? extends Session> repository = new ReactiveRedisOperationsSessionRepository(redisTemplate);
// end::new-reactiveredisoperationssessionrepository[]
}
Also used : ReactiveRedisTemplate(org.springframework.data.redis.core.ReactiveRedisTemplate) JdkSerializationRedisSerializer(org.springframework.data.redis.serializer.JdkSerializationRedisSerializer) LettuceConnectionFactory(org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory) ReactiveRedisOperationsSessionRepository(org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 LettuceConnectionFactory (org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory)1 ReactiveRedisTemplate (org.springframework.data.redis.core.ReactiveRedisTemplate)1 JdkSerializationRedisSerializer (org.springframework.data.redis.serializer.JdkSerializationRedisSerializer)1 ReactiveRedisOperationsSessionRepository (org.springframework.session.data.redis.ReactiveRedisOperationsSessionRepository)1