Class RedisTemplateFactory

java.lang.Object
io.github.xezzon.zeroweb.common.redis.RedisTemplateFactory

@Configuration @Profile("redis") public class RedisTemplateFactory extends Object
Author:
xezzon
  • Constructor Summary

    Constructors
    Constructor
    Description
    RedisTemplateFactory(org.springframework.data.redis.connection.RedisConnectionFactory connectionFactory, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> org.springframework.data.redis.core.RedisTemplate<String,T>
    常规 Redis 处理器
    <T> org.springframework.data.redis.core.RedisTemplate<String,T>
    of(Class<T> tClass)
    指定值类型的 Redis 处理器 使用方法如下:

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RedisTemplateFactory

      public RedisTemplateFactory(org.springframework.data.redis.connection.RedisConnectionFactory connectionFactory, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
  • Method Details

    • of

      public <T> org.springframework.data.redis.core.RedisTemplate<String,T> of(Class<T> tClass)
      指定值类型的 Redis 处理器 使用方法如下:
       public class AnyService {
         private final RedisTemplate<String, Any> anyRedisTemplate;
         public AnyService(RedisTemplateFactory factory) {
           this.anyRedisTemplate = factory.of(Any.class)
         }
       }
       
    • genericRedisTemplate

      @Bean public <T> org.springframework.data.redis.core.RedisTemplate<String,T> genericRedisTemplate()
      常规 Redis 处理器