Class HashtableCache

java.lang.Object
org.hibernate.cache.HashtableCache
All Implemented Interfaces:
Cache

public class HashtableCache extends Object implements Cache
A lightweight implementation of the Cache interface
  • Constructor Details

    • HashtableCache

      public HashtableCache(String regionName)
  • Method Details

    • getRegionName

      public String getRegionName()
      Description copied from interface: Cache
      Get the name of the cache region
      Specified by:
      getRegionName in interface Cache
    • read

      public Object read(Object key) throws CacheException
      Description copied from interface: Cache
      Get an item from the cache
      Specified by:
      read in interface Cache
      Parameters:
      key -
      Returns:
      the cached object or null
      Throws:
      CacheException
    • get

      public Object get(Object key) throws CacheException
      Description copied from interface: Cache
      Get an item from the cache, nontransactionally
      Specified by:
      get in interface Cache
      Parameters:
      key -
      Returns:
      the cached object or null
      Throws:
      CacheException
    • update

      public void update(Object key, Object value) throws CacheException
      Description copied from interface: Cache
      Add an item to the cache
      Specified by:
      update in interface Cache
      Parameters:
      key -
      value -
      Throws:
      CacheException
    • put

      public void put(Object key, Object value) throws CacheException
      Description copied from interface: Cache
      Add an item to the cache, nontransactionally, with failfast semantics
      Specified by:
      put in interface Cache
      Parameters:
      key -
      value -
      Throws:
      CacheException
    • remove

      public void remove(Object key) throws CacheException
      Description copied from interface: Cache
      Remove an item from the cache
      Specified by:
      remove in interface Cache
      Throws:
      CacheException
    • clear

      public void clear() throws CacheException
      Description copied from interface: Cache
      Clear the cache
      Specified by:
      clear in interface Cache
      Throws:
      CacheException
    • destroy

      public void destroy() throws CacheException
      Description copied from interface: Cache
      Clean up
      Specified by:
      destroy in interface Cache
      Throws:
      CacheException
    • lock

      public void lock(Object key) throws CacheException
      Description copied from interface: Cache
      If this is a clustered cache, lock the item
      Specified by:
      lock in interface Cache
      Throws:
      CacheException
    • unlock

      public void unlock(Object key) throws CacheException
      Description copied from interface: Cache
      If this is a clustered cache, unlock the item
      Specified by:
      unlock in interface Cache
      Throws:
      CacheException
    • nextTimestamp

      public long nextTimestamp()
      Description copied from interface: Cache
      Generate a timestamp
      Specified by:
      nextTimestamp in interface Cache
    • getTimeout

      public int getTimeout()
      Description copied from interface: Cache
      Get a reasonable "lock timeout"
      Specified by:
      getTimeout in interface Cache
    • getSizeInMemory

      public long getSizeInMemory()
      Description copied from interface: Cache
      The number of bytes is this cache region currently consuming in memory.
      Specified by:
      getSizeInMemory in interface Cache
      Returns:
      The number of bytes consumed by this region; -1 if unknown or unsupported.
    • getElementCountInMemory

      public long getElementCountInMemory()
      Description copied from interface: Cache
      The count of entries currently contained in the regions in-memory store.
      Specified by:
      getElementCountInMemory in interface Cache
      Returns:
      The count of entries in memory; -1 if unknown or unsupported.
    • getElementCountOnDisk

      public long getElementCountOnDisk()
      Description copied from interface: Cache
      The count of entries currently contained in the regions disk store.
      Specified by:
      getElementCountOnDisk in interface Cache
      Returns:
      The count of entries on disk; -1 if unknown or unsupported.
    • toMap

      public Map toMap()
      Description copied from interface: Cache
      optional operation
      Specified by:
      toMap in interface Cache
    • toString

      public String toString()
      Overrides:
      toString in class Object