Class LocalCacheImpl

java.lang.Object
cn.toint.oktool.spring.boot.cache.impl.LocalCacheImpl
All Implemented Interfaces:
Cache

public class LocalCacheImpl extends Object implements Cache
本地缓存
Author:
Toint
  • Constructor Details

    • LocalCacheImpl

      public LocalCacheImpl()
  • Method Details

    • put

      public void put(String key, String value, Duration timeout)
      Description copied from interface: Cache
      设置缓存
      Specified by:
      put in interface Cache
      Parameters:
      key - 缓存键, 不能为空
      value - 缓存值
      timeout - 缓存时间, 不能为空
    • putIfAbsent

      public boolean putIfAbsent(String key, String value, Duration timeout)
      Description copied from interface: Cache
      设置缓存如果不存在
      Specified by:
      putIfAbsent in interface Cache
      Parameters:
      key - 缓存键, 不能为空
      value - 缓存值
      timeout - 缓存时间, 不能为空
      Returns:
      true=设置成功, false=不成功
    • get

      public String get(String key)
      Description copied from interface: Cache
      获取缓存
      Specified by:
      get in interface Cache
      Parameters:
      key - 缓存键
      Returns:
      缓存值
    • multiGet

      public List<String> multiGet(Collection<String> keys)
      Description copied from interface: Cache
      获取缓存
      Specified by:
      multiGet in interface Cache
      Parameters:
      keys - 缓存键
      Returns:
      缓存值集合, 如果对应位置的key不存在, 则用null占位
    • containsKey

      public boolean containsKey(String key)
      Description copied from interface: Cache
      缓存是否存在
      Specified by:
      containsKey in interface Cache
      Parameters:
      key - 缓存键, 不能为空
      Returns:
      true=存在, false=不存在
    • delete

      public void delete(String key)
      Description copied from interface: Cache
      删除缓存
      Specified by:
      delete in interface Cache
      Parameters:
      key - 缓存键, 不能为空