Package org.javalite.activejdbc.cache
Enum Class QueryCache
- All Implemented Interfaces:
Serializable
,Comparable<QueryCache>
,Constable
This is a main cache facade.
- Author:
- Igor Polevoy
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an item to cache.Returns an item from cache, or null if nothing found.static QueryCache
instance()
This class is a singleton, get an instance with this method.boolean
void
purgeTableCache(String tableName)
UsepurgeTableCache(MetaModel)
whenever you can.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.static QueryCache
Returns the enum constant of this class with the specified name.static QueryCache[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INSTANCE
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
isEnabled
public boolean isEnabled() -
instance
This class is a singleton, get an instance with this method.- Returns:
- one and only one instance of this class.
-
addItem
Adds an item to cache. Expected some lists of objects returned from "select" queries.- Parameters:
tableName
- - name of table.query
- query textparams
- - list of parameters for a query.cache
- object to cache.
-
getItem
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
This method purges (removes) all caches associated with a table, if caching is enabled and a corresponding model is marked cached.- Parameters:
metaModel
- meta-model whose caches are to purge.
-
purgeTableCache
UsepurgeTableCache(MetaModel)
whenever you can.- Parameters:
tableName
- name of table whose caches to purge.
-
getCacheManager
-