RedisGeneratorDao.java 787 Bytes
package com.pudp.bae.base;
 
import java.io.Serializable;

import javax.annotation.Resource;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;
 
public abstract class RedisGeneratorDao<K extends Serializable, V extends Serializable>  {
   
  @Resource
  protected RedisTemplate<K,V> redisTemplate ;
 
  /**
   * 设置redisTemplate
   * @param redisTemplate the redisTemplate to set
   */ 
  public void setRedisTemplate(RedisTemplate<K, V> redisTemplate) { 
    this.redisTemplate = redisTemplate; 
  } 
     
  /**
   * 获取 RedisSerializer
   * <br>------------------------------<br>
   */ 
  protected RedisSerializer<String> getRedisSerializer() { 
    return redisTemplate.getStringSerializer(); 
  }
 
}