接口 ICache

所有已知实现类:
AbsCache, CaffeineCache, CaffeineRedisCache, GuavaCache, GuavaRedisCache, J2Cache, RedisCache

public interface ICache
作者:
tanyaowu 2017年8月10日 上午11:38:26
  • 字段详细资料

    • NULL_OBJ

      static final ICache.NullClass NULL_OBJ
      用于临时存放于缓存中的对象,防止缓存null攻击
    • MAX_EXPIRE_IN_LOCAL

      static final int MAX_EXPIRE_IN_LOCAL
      在本地最大的过期时间,这样可以防止内存爆掉,单位:秒
      另请参阅:
  • 方法详细资料

    • getCacheName

      String getCacheName()
      返回:
    • clear

      void clear()
      清空所有缓存
    • get

      Serializable get(String key)
      根据key获取value
      参数:
      key -
      返回:
    • get

      <T> T get(String key, Class<T> clazz)
      根据key获取value
      参数:
      key -
      clazz -
      返回:
    • keys

      Iterable<String> keys()
      获取所有的key
      返回:
    • put

      void put(String key, Serializable value)
      将key value保存到缓存中
      参数:
      key -
      value -
    • remove

      void remove(String key)
      删除一个key
      参数:
      key -
    • putTemporary

      void putTemporary(String key, Serializable value)
      临时添加一个值,用于防止缓存穿透攻击
      参数:
      key -
      value -
    • ttl

      long ttl(String key)
      对象还会存活多久。
      返回:
      currTime in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
    • getTimeToLiveSeconds

      Long getTimeToLiveSeconds()
      返回:
    • getTimeToIdleSeconds

      Long getTimeToIdleSeconds()
      返回: