类 CaffeineCache

java.lang.Object
org.beetl.core.impl.cache.CaffeineCache
所有已实现的接口:
IBeetlCache

public class CaffeineCache extends Object implements IBeetlCache
使用Caffeine
  • 构造器详细资料

    • CaffeineCache

      public CaffeineCache()
  • 方法详细资料

    • init

      public void init(Configuration configuration)
      指定者:
      init 在接口中 IBeetlCache
    • get

      public Object get(Object key)
      从接口复制的说明: IBeetlCache
      通过 key 从缓存中获取对应的 value
      指定者:
      get 在接口中 IBeetlCache
      参数:
      key - 键,有可能为 null
      返回:
      返回缓存中 key 所对应的 value,有可能为 null
    • get

      public Object get(Object key, Function function)
      从接口复制的说明: IBeetlCache
      通过 key 从缓存中获取对应的 value; 如果获取的value为null,则将 function#apply 方法的返回值作为newValue,添加到缓存中,并返回
      指定者:
      get 在接口中 IBeetlCache
      参数:
      key - 键,有可能为 null
      function - 函数,在通过key获取value为null时,将执行 function#apply 方法
      返回:
      如果获取的value为null,则将 function#apply 方法的返回值作为newValue,添加到缓存中,并返回
    • remove

      public void remove(Object key)
      从接口复制的说明: IBeetlCache
      移除缓存中 key 所对应的 value
      指定者:
      remove 在接口中 IBeetlCache
      参数:
      key - 键,有可能为null
    • set

      public void set(Object key, Object value)
      从接口复制的说明: IBeetlCache
      设置缓存中的键值对,如果key已存在,则更新value
      指定者:
      set 在接口中 IBeetlCache
      参数:
      key - 键
      value - 新值
    • clearAll

      public void clearAll()
      从接口复制的说明: IBeetlCache
      清理缓存
      指定者:
      clearAll 在接口中 IBeetlCache
    • size

      public long size()
      此方法不应该经常被调用,因为会触发cleanUP操作,返回一个精确值。
      指定者:
      size 在接口中 IBeetlCache
      返回: