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)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> org.springframework.data.redis.core.RedisTemplate<String,T>
    of(com.google.common.reflect.TypeToken<T> typeToken)
    指定值类型的 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)
  • Method Details

    • of

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