io.leopard.web.session.StoreRedisImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leopard-session Show documentation
Show all versions of leopard-session Show documentation
分布式session实现。基于Leopard Memcache接口实现,目前Leopard已实现基于Memcached、Redis两种实现。
package io.leopard.web.session;
import io.leopard.redis.Redis;
public class StoreRedisImpl implements IStore {
private static Redis redis;
public static void setRedis(Redis redis) {
StoreRedisImpl.redis = redis;
}
@Override
public boolean isEnable() {
return redis != null;
}
@Override
public String get(String key) {
// System.err.println("StoreRedisImpl get:" + key);
return redis.get(key);
}
@Override
public String set(String key, String value, int seconds) {
return redis.set(key, value, seconds);
}
@Override
public Long del(String key) {
return redis.del(key);
}
}