Class AuthDefaultCache

java.lang.Object
me.zhyd.oauth.cache.AuthDefaultCache
All Implemented Interfaces:
AuthCache

public class AuthDefaultCache extends Object implements AuthCache
默认的缓存实现
Since:
1.9.3
Author:
yadong.zhang (yadong.zhang0415(a)gmail.com)
  • Constructor Details

    • AuthDefaultCache

      public AuthDefaultCache()
  • Method Details

    • set

      public void set(String key, String value)
      设置缓存
      Specified by:
      set in interface AuthCache
      Parameters:
      key - 缓存KEY
      value - 缓存内容
    • set

      public void set(String key, String value, long timeout)
      设置缓存
      Specified by:
      set in interface AuthCache
      Parameters:
      key - 缓存KEY
      value - 缓存内容
      timeout - 指定缓存过期时间(毫秒)
    • get

      public String get(String key)
      获取缓存
      Specified by:
      get in interface AuthCache
      Parameters:
      key - 缓存KEY
      Returns:
      缓存内容
    • containsKey

      public boolean containsKey(String key)
      是否存在key,如果对应key的value值已过期,也返回false
      Specified by:
      containsKey in interface AuthCache
      Parameters:
      key - 缓存KEY
      Returns:
      true:存在key,并且value没过期;false:key不存在或者已过期
    • pruneCache

      public void pruneCache()
      清理过期的缓存
      Specified by:
      pruneCache in interface AuthCache
    • schedulePrune

      public void schedulePrune(long delay)
      定时清理
      Parameters:
      delay - 间隔时长,单位毫秒