Class CacheManager

Direct Known Subclasses:
EHCache3Manager, EHCacheManager, NopeCacheManager, RedisCacheManager

public abstract class CacheManager extends Object
Abstract method to be sub-classed by various caching technologies.
Igor Polevoy
  • Constructor Details

    • CacheManager

      public CacheManager()
  • Method Details

    • getCache

      public abstract Object getCache(String group, String key)
      Returns a cached item. Can return null if not found.
      group - group of caches - this is a name of a table for which query results are cached
      key - key of the item.
      a cached item. Can return null if not found.
    • addCache

      public abstract void addCache(String group, String key, Object cache)
      Adds item to cache.
      group - group name of cache.
      key - key of the item.
      cache - cache item to add to cache.
    • doFlush

      public abstract void doFlush(CacheEvent event)
    • flush

      public final void flush(CacheEvent event, boolean propagate)
      Flashes cache.
      propagate - true to propagate event to listeners, false to not propagate
      event - type of caches to flush.
    • flush

      public final void flush(CacheEvent event)
      Flashes cache.
      event - type of caches to flush.
    • addCacheEventListener

      public final void addCacheEventListener(CacheEventListener listener)
    • removeCacheEventListener

      public final void removeCacheEventListener(CacheEventListener listener)
    • removeAllCacheEventListeners

      public final void removeAllCacheEventListeners()
    • purgeTableCache

      public void purgeTableCache(MetaModel metaModel)
      This method purges (removes) all caches associated with a table, if caching is enabled and a corresponding model is marked cached.
      metaModel - meta-model whose caches are to purge.
    • purgeTableCache

      public void purgeTableCache(String tableName)
      Use purgeTableCache(MetaModel) whenever you can.
      tableName - name of table whose caches to purge.
    • getKey

      public String getKey(String tableName, String query, Object[] params)
      Generates a cache key. Subclasses may override this implementation.
      tableName - name of a table
      query - query
      params - query parameters.
      generated key for tied to these parameters.
    • getImplementation

      public abstract Object getImplementation()
      Returns underlying instance of implementation for specific configuration.
      actual underlying implementation of cache. The same as configured in file. For instance: redis.clients.jedis.JedisPool.