com.github.ibole.infrastructure.cache.redis.RedisCacheWrapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of infrastructure-all Show documentation
Show all versions of infrastructure-all Show documentation
The all in one project of ibole infrastructure
The newest version!
package com.github.ibole.infrastructure.cache.redis;
import com.github.ibole.infrastructure.cache.CacheWrapper;
import com.github.ibole.infrastructure.common.serialization.KryoSerializationUtil;
/*********************************************************************************************.
*
*
* Copyright 2016, iBole Inc. All rights reserved.
*
*
*********************************************************************************************/
/**
* @author bwang
*
*/
public class RedisCacheWrapper implements CacheWrapper {
private RedisSimpleTempalte redisTemplate;
public RedisCacheWrapper(RedisSimpleTempalte redisTemplate) {
this.redisTemplate = redisTemplate;
}
@Override
public void put(K key, V value) {
redisTemplate
.setSafety(key.toString(), KryoSerializationUtil.getInstance().serialize(value), 0);
}
@Override
public V get(K key) {
return KryoSerializationUtil.getInstance().deserialize(
redisTemplate.getSafetyByte(key.toString()));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy