类 AbstractCacheService

java.lang.Object
cn.zhxu.toys.cache.AbstractCacheService
所有已实现的接口:
CacheService
直接已知子类:
RedisCacheService, RedisTemplateCacheService

public abstract class AbstractCacheService extends Object implements CacheService
从以下版本开始:
v0.4.9
作者:
Troy.Zhou
  • 构造器详细资料

    • AbstractCacheService

      public AbstractCacheService()
  • 方法详细资料

    • cache

      public <T> T cache(String key, Class<T> resType)
      从接口复制的说明: CacheService
      只读
      指定者:
      cache 在接口中 CacheService
      类型参数:
      T - 泛型
      参数:
      key - 键
      resType - 类型
    • cache

      public <T> T cache(String key, cn.zhxu.data.TypeRef<T> resType)
      从接口复制的说明: CacheService
      只读
      指定者:
      cache 在接口中 CacheService
      类型参数:
      T - 泛型
      参数:
      key - 键
      resType - 类型
    • cacheShort

      public <T> T cacheShort(String key, Class<T> resType, CacheGetter<T> getter)
      从接口复制的说明: CacheService
      先读,读不到则写
      指定者:
      cacheShort 在接口中 CacheService
      类型参数:
      T - 泛型
      参数:
      key - 键
      resType - 类型
      getter - CacheGetter
    • cacheShort

      public <T> T cacheShort(String key, cn.zhxu.data.TypeRef<T> resType, CacheGetter<T> getter)
      从接口复制的说明: CacheService
      先读,读不到则写
      指定者:
      cacheShort 在接口中 CacheService
      类型参数:
      T - 泛型
      参数:
      key - 键
      resType - 类型
      getter - CacheGetter
    • cacheMedium

      public <T> T cacheMedium(String key, Class<T> resType, CacheGetter<T> getter)
      从接口复制的说明: CacheService
      先读,读不到则写
      指定者:
      cacheMedium 在接口中 CacheService
      类型参数:
      T - 泛型
      参数:
      key - 键
      resType - 类型
      getter - CacheGetter
    • cacheMedium

      public <T> T cacheMedium(String key, cn.zhxu.data.TypeRef<T> resType, CacheGetter<T> getter)
      从接口复制的说明: CacheService
      先读,读不到则写
      指定者:
      cacheMedium 在接口中 CacheService
      类型参数:
      T - 泛型
      参数:
      key - 键
      resType - 类型
      getter - CacheGetter
    • cacheLong

      public <T> T cacheLong(String key, Class<T> resType, CacheGetter<T> getter)
      从接口复制的说明: CacheService
      先读,读不到则写
      指定者:
      cacheLong 在接口中 CacheService
      类型参数:
      T - 泛型
      参数:
      key - 键
      resType - 类型
      getter - CacheGetter
    • cacheLong

      public <T> T cacheLong(String key, cn.zhxu.data.TypeRef<T> resType, CacheGetter<T> getter)
      从接口复制的说明: CacheService
      先读,读不到则写
      指定者:
      cacheLong 在接口中 CacheService
      类型参数:
      T - 泛型
      参数:
      key - 键
      resType - 类型
      getter - CacheGetter
    • cacheShort

      public void cacheShort(String key, Object object)
      从接口复制的说明: CacheService
      只写
      指定者:
      cacheShort 在接口中 CacheService
      参数:
      key - 键
      object - 对象
    • cacheMedium

      public void cacheMedium(String key, Object object)
      从接口复制的说明: CacheService
      只写
      指定者:
      cacheMedium 在接口中 CacheService
      参数:
      key - 键
      object - 对象
    • cacheLong

      public void cacheLong(String key, Object object)
      从接口复制的说明: CacheService
      只写
      指定者:
      cacheLong 在接口中 CacheService
      参数:
      key - 键
      object - 对象
    • cache

      public <T> T cache(String key, int timeoutSeconds, Class<T> resType, CacheGetter<T> getter)
      从接口复制的说明: CacheService
      先读,读不到则写
      指定者:
      cache 在接口中 CacheService
      类型参数:
      T - 泛型
      参数:
      key - 键
      timeoutSeconds - 过期秒数
      resType - 类型
      getter - CacheGetter
    • cache

      public <T> T cache(String key, int timeoutSeconds, cn.zhxu.data.TypeRef<T> resType, CacheGetter<T> getter)
      从接口复制的说明: CacheService
      先读,读不到则写
      指定者:
      cache 在接口中 CacheService
      类型参数:
      T - 泛型
      参数:
      key - 键
      timeoutSeconds - 过期秒数
      resType - 类型
      getter - CacheGetter
    • cacheBean

      public <T> T cacheBean(String key, int timeoutSeconds, Class<T> resType, CacheGetter<T> getter)
      从接口复制的说明: CacheService
      先读,读不到则写
      指定者:
      cacheBean 在接口中 CacheService
      类型参数:
      T - 泛型
      参数:
      key - 键
      timeoutSeconds - 过期秒数
      resType - 类型
      getter - CacheGetter
    • cacheList

      public <T> List<T> cacheList(String key, int timeoutSeconds, Class<T> resType, CacheGetter<List<T>> getter)
      从接口复制的说明: CacheService
      先读,读不到则写
      指定者:
      cacheList 在接口中 CacheService
      类型参数:
      T - 泛型
      参数:
      key - 键
      timeoutSeconds - 过期秒数
      resType - 类型
      getter - CacheGetter
    • doCache

      protected abstract <T> T doCache(String key, int timeoutSeconds, Type resType, CacheGetter<T> getter)
      先读,都读到则返回,否则若 getter 非空,则写
      类型参数:
      T - 泛型
      参数:
      key - 缓存键
      timeoutSeconds - 过期秒数
      resType - 返回类型
      getter - 获取器
      返回:
      缓存值
    • doCacheList

      protected abstract <T> List<T> doCacheList(String key, int timeoutSeconds, Class<T> resType, CacheGetter<List<T>> getter)
      先读,都读到则返回,否则若 getter 非空,则写
      类型参数:
      T - 泛型
      参数:
      key - 缓存键
      timeoutSeconds - 过期秒数
      resType - 返回类型
      getter - 获取器
      返回:
      缓存值
    • toBean

      protected <T> T toBean(String cache, Type resType)
    • toList

      protected <T> List<T> toList(String cache, Class<T> resType)
    • toString

      protected String toString(Object object)
    • isNotConvertStrToJson

      public boolean isNotConvertStrToJson()
      返回:
      是否不将字符串转换为 JSON
    • setNotConvertStrToJson

      public void setNotConvertStrToJson(boolean notConvertStrToJson)