类 EhCache

java.lang.Object
net.oschina.j2cache.ehcache.EhCache
所有已实现的接口:
Cloneable, Cache, Level1Cache, net.sf.ehcache.event.CacheEventListener

public class EhCache extends Object implements Level1Cache, net.sf.ehcache.event.CacheEventListener

EHCache 2.x 的缓存封装

该封装类实现了缓存操作以及对缓存数据失效的侦听

作者:
Winter Lau(javayou@gmail.com)
  • 构造器详细资料

    • EhCache

      public EhCache(net.sf.ehcache.Cache cache, CacheExpiredListener listener)
      Creates a new EhCache instance
      参数:
      cache - The underlying EhCache instance to use.
      listener - cache listener
  • 方法详细资料

    • ttl

      public long ttl()
      从接口复制的说明: Level1Cache
      返回该缓存区域的 TTL 设置(单位:秒)
      指定者:
      ttl 在接口中 Level1Cache
      返回:
      true if cache support ttl setting
    • size

      public long size()
      从接口复制的说明: Level1Cache
      返回该缓存区域中,内存存储对象的最大数量
      指定者:
      size 在接口中 Level1Cache
      返回:
      cache size in memory
    • keys

      public Collection<String> keys()
      从接口复制的说明: Cache
      Return all keys
      指定者:
      keys 在接口中 Cache
      返回:
      返回键的集合
    • get

      public Serializable get(String key)
      Gets a value of an element which matches the given key.
      指定者:
      get 在接口中 Cache
      参数:
      key - the key of the element to return.
      返回:
      The value placed into the cache with an earlier put, or null if not found or expired
    • put

      public void put(String key, Object value)
      Puts an object into the cache.
      指定者:
      put 在接口中 Cache
      参数:
      key - a key
      value - a value
    • evict

      public void evict(String... keys)
      Removes the element which matches the key If no element matches, nothing is removed and no Exception is thrown.
      指定者:
      evict 在接口中 Cache
      参数:
      keys - the key of the element to remove
    • get

      public Map<String,Object> get(Collection<String> keys)
      从接口复制的说明: Cache
      批量获取缓存对象
      指定者:
      get 在接口中 Cache
      参数:
      keys - cache keys
      返回:
      return key-value objects
    • exists

      public boolean exists(String key)
      从接口复制的说明: Cache
      判断缓存是否存在
      指定者:
      exists 在接口中 Cache
      参数:
      key - cache key
      返回:
      true if key exists
    • put

      public void put(Map<String,Object> elements)
      从接口复制的说明: Cache
      批量插入数据
      指定者:
      put 在接口中 Cache
      参数:
      elements - objects to be put in cache
    • clear

      public void clear()
      Remove all elements in the cache, but leave the cache in a useable state.
      指定者:
      clear 在接口中 Cache
    • clone

      public Object clone() throws CloneNotSupportedException
      指定者:
      clone 在接口中 net.sf.ehcache.event.CacheEventListener
      覆盖:
      clone 在类中 Object
      抛出:
      CloneNotSupportedException
    • notifyElementExpired

      public void notifyElementExpired(net.sf.ehcache.Ehcache cache, net.sf.ehcache.Element elem)
      指定者:
      notifyElementExpired 在接口中 net.sf.ehcache.event.CacheEventListener
    • notifyElementEvicted

      public void notifyElementEvicted(net.sf.ehcache.Ehcache cache, net.sf.ehcache.Element elem)
      指定者:
      notifyElementEvicted 在接口中 net.sf.ehcache.event.CacheEventListener
    • notifyElementPut

      public void notifyElementPut(net.sf.ehcache.Ehcache cache, net.sf.ehcache.Element elem)
      指定者:
      notifyElementPut 在接口中 net.sf.ehcache.event.CacheEventListener
    • notifyElementRemoved

      public void notifyElementRemoved(net.sf.ehcache.Ehcache cache, net.sf.ehcache.Element elem)
      指定者:
      notifyElementRemoved 在接口中 net.sf.ehcache.event.CacheEventListener
    • notifyElementUpdated

      public void notifyElementUpdated(net.sf.ehcache.Ehcache cache, net.sf.ehcache.Element elem)
      指定者:
      notifyElementUpdated 在接口中 net.sf.ehcache.event.CacheEventListener
    • notifyRemoveAll

      public void notifyRemoveAll(net.sf.ehcache.Ehcache cache)
      指定者:
      notifyRemoveAll 在接口中 net.sf.ehcache.event.CacheEventListener
    • dispose

      public void dispose()
      指定者:
      dispose 在接口中 net.sf.ehcache.event.CacheEventListener