com.foxinmy.weixin4j.cache
Class RedisCacheStorager<T extends Cacheable>

java.lang.Object
  extended by com.foxinmy.weixin4j.cache.RedisCacheStorager<T>
All Implemented Interfaces:
CacheStorager<T>

public class RedisCacheStorager<T extends Cacheable>
extends Object
implements CacheStorager<T>

用Redis保存缓存对象(推荐使用)

Since:
JDK 1.6
Author:
jinyu(foxinmy@gmail.com)

Field Summary
 
Fields inherited from interface com.foxinmy.weixin4j.cache.CacheStorager
ALLKEY, CUTMS
 
Constructor Summary
RedisCacheStorager()
           
RedisCacheStorager(redis.clients.jedis.JedisPoolConfig poolConfig)
           
RedisCacheStorager(redis.clients.util.Pool<redis.clients.jedis.Jedis> jedisPool)
           
RedisCacheStorager(String host, int port, int timeout)
           
RedisCacheStorager(String host, int port, int timeout, String password)
           
RedisCacheStorager(String host, int port, int timeout, String password, redis.clients.jedis.JedisPoolConfig poolConfig)
           
 
Method Summary
 void caching(String key, T cache)
          缓存新的对象
 void clear()
          清除所有缓存对象(请慎重)
 T evict(String key)
          移除缓存对象
 T lookup(String key)
          查找缓存中的对象
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RedisCacheStorager

public RedisCacheStorager()

RedisCacheStorager

public RedisCacheStorager(String host,
                          int port,
                          int timeout)

RedisCacheStorager

public RedisCacheStorager(String host,
                          int port,
                          int timeout,
                          String password)

RedisCacheStorager

public RedisCacheStorager(redis.clients.jedis.JedisPoolConfig poolConfig)

RedisCacheStorager

public RedisCacheStorager(String host,
                          int port,
                          int timeout,
                          String password,
                          redis.clients.jedis.JedisPoolConfig poolConfig)

RedisCacheStorager

public RedisCacheStorager(redis.clients.util.Pool<redis.clients.jedis.Jedis> jedisPool)
Method Detail

lookup

public T lookup(String key)
Description copied from interface: CacheStorager
查找缓存中的对象

Specified by:
lookup in interface CacheStorager<T extends Cacheable>
Parameters:
key - 缓存key
Returns:
缓存对象

caching

public void caching(String key,
                    T cache)
Description copied from interface: CacheStorager
缓存新的对象

Specified by:
caching in interface CacheStorager<T extends Cacheable>
Parameters:
key - 缓存key
cache - 将要缓存的对象

evict

public T evict(String key)
Description copied from interface: CacheStorager
移除缓存对象

Specified by:
evict in interface CacheStorager<T extends Cacheable>
Parameters:
key - 缓存key
Returns:
移除的对象

clear

public void clear()
Description copied from interface: CacheStorager
清除所有缓存对象(请慎重)

Specified by:
clear in interface CacheStorager<T extends Cacheable>


Copyright © 2014–2017. All rights reserved.