接口 CacheOps

所有已知子接口:
CachePlusOps
所有已知实现类:
CaffeineOpsImpl, RedisOpsImpl

public interface CacheOps
缓存操作公共接口
作者:
zuihou
  • 方法详细资料

    • del

      Long del(@NonNull CacheKey... keys)
      删除指定的key
      参数:
      keys - 多个key
      返回:
      删除个数
    • del

      Long del(@NonNull Collection<CacheKey> keys)
      删除指定的key
      参数:
      keys - 多个key
      返回:
      删除个数
    • del

      Long del(@NonNull String... keys)
      删除指定的key
      参数:
      keys - 多个key
      返回:
      删除个数
    • exists

      Boolean exists(@NonNull CacheKey key)
      判断指定的key 是否存在
      参数:
      key - key
      返回:
      是否存在
    • set

      void set(@NonNull CacheKey key, Object value, boolean... cacheNullValues)
      添加到带有 过期时间的 缓存
      参数:
      key - redis主键
      value - 值
      cacheNullValues - 是否缓存null对象
    • get

      <T> CacheResult<T> get(@NonNull CacheKey key, boolean... cacheNullValues)
      根据key获取对象
      参数:
      key - redis主键
      cacheNullValues - 是否缓存null对象
      返回:
      值 不存在时,返回null
    • get

      <T> CacheResult<T> get(@NonNull String key, boolean... cacheNullValues)
      根据key获取对象
      参数:
      key - redis主键
      cacheNullValues - 是否缓存null对象
      返回:
      值 不存在时,返回null
    • find

      <T> List<CacheResult<T>> find(@NonNull Collection<CacheKey> keys)
      根据keys获取对象
      参数:
      keys - redis主键
      返回:
      值 不存在时,返回空集合
    • get

      <T> CacheResult<T> get(@NonNull CacheKey key, Function<CacheKey,? extends T> loader, boolean... cacheNullValues)
      根据key获取对象 不存在时,调用function回调获取数据,并set进入,然后返回
      参数:
      key - redis主键
      loader - 加载器
      cacheNullValues - 是否缓存null对象
      返回:
    • flushDb

      void flushDb()
      清空所有存储的数据
    • incr

      Long incr(@NonNull CacheKey key)
      为键 key 储存的数字值加上一。
      参数:
      key - 一定不能为 null.
      返回:
      返回键 key 在执行加一操作之后的值。
    • getCounter

      Long getCounter(@NonNull CacheKey key, Function<CacheKey,Long> loader)
      获取key中存放的Long值
      参数:
      key - 一定不能为 null.
      loader - 加载
      返回:
      key中存储的的数字
    • incrBy

      Long incrBy(@NonNull CacheKey key, long increment)
      为键 key 储存的数字值加上increment。
      参数:
      key - 一定不能为 null.
      increment - 增量值
      返回:
      返回键 key 在执行加一操作之后的值。
    • incrByFloat

      Double incrByFloat(@NonNull CacheKey key, double increment)
      为键 key 储存的数字值加上一。
      参数:
      key - 一定不能为 null.
      increment - 增量值
      返回:
      返回键 key 在执行加一操作之后的值。
    • decr

      Long decr(@NonNull CacheKey key)
      为键 key 储存的数字值减去一。
      参数:
      key - 一定不能为 null.
      返回:
      在减去增量 1 之后, 键 key 的值。
    • decrBy

      Long decrBy(@NonNull CacheKey key, long decrement)
      将 key 所储存的值减去减量 decrement 。
      参数:
      key - 一定不能为 null.
      decrement - 增量值
      返回:
      在减去增量 decrement 之后, 键 key 的值。