org.javalite.activejdbc.cache
Class QueryCache

java.lang.Object
  extended by org.javalite.activejdbc.cache.QueryCache

public class QueryCache
extends Object

This is a main cache facade. It could be architected in the future to add more cache implementations besides OSCache.

Author:
Igor Polevoy

Method Summary
 void addItem(String tableName, String query, Object[] params, Object cache)
          Adds an item to cache.
 CacheManager getCacheManager()
           
 Object getItem(String tableName, String query, Object[] params)
          Returns an item from cache, or null if nothing found.
static QueryCache instance()
          This class is a singleton, get an instance with this method.
 void purgeTableCache(String tableName)
          This method purges (removes) all caches associated with a table, if caching is enabled and a corresponding model is marked cached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static QueryCache instance()
This class is a singleton, get an instance with this method.

Returns:
one and only one instance of this class.

addItem

public void addItem(String tableName,
                    String query,
                    Object[] params,
                    Object cache)
Adds an item to cache. Expected some lists of objects returned from "select" queries.

Parameters:
tableName - - name of table.
query - query text
params - - list of parameters for a query.
cache - object to cache.

getItem

public Object getItem(String tableName,
                      String query,
                      Object[] params)
Returns an item from cache, or null if nothing found.

Parameters:
tableName - name of table.
query - query text.
params - list of query parameters, can be null if no parameters are provided.
Returns:
cache object or null if nothing found.

purgeTableCache

public void purgeTableCache(String tableName)
This method purges (removes) all caches associated with a table, if caching is enabled and a corresponding model is marked cached.

Parameters:
tableName - table name whose caches are to be purged.

getCacheManager

public CacheManager getCacheManager()


Copyright © 2013. All Rights Reserved.