I have a Spring Hibernate Application. In my application, Recently i am implemented Spring data Redis.
spring-servlet.xml
<!-- redis connection factory -->
<bean id="jedisConnFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory" p:use-pool="true"/>
<!-- redis template definition -->
<bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate"
p:connection-factory-ref="jedisConnFactory"/>
And this redisTemplate
use in my ServiceImpl class.
RedisServiceImpl
@Autowired
private RedisTemplate<String, T> redisTemplate;
public RedisTemplate<String, T> getRedisTemplate() {
return redisTemplate;
}
public void setRedisTemplate(RedisTemplate<String, T> redisTemplate) {
this.redisTemplate = redisTemplate;
}
Now I added data in redisServer like this
public void putData(String uniqueKey, String key, Object results) {
redisTemplate.opsForHash().put(uniqueKey, key, results);
}
Now i want to remove Expire key.
I search in Google, But in google all are saying like this
redisTemplate.expire(key, timeout, TimeUnit);
In this expire method, We need to provide uniqueKey
instead of key
.
But I need to Expire key
instead of uniqueKey
.
So Please help me what can i do for expire Key
?