public class PreparedQueryCacheImpl extends Object implements PreparedQueryCache
prepared queries.| Modifier and Type | Class and Description |
|---|---|
static class |
PreparedQueryCacheImpl.StrongExclusion
Strong exclusion.
|
static class |
PreparedQueryCacheImpl.WeakExclusion
Weak exclusion.
|
PreparedQueryCache.Exclusion| Constructor and Description |
|---|
PreparedQueryCacheImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addExclusionPattern(String pattern)
Adds a pattern for exclusion.
|
boolean |
cache(PreparedQuery q)
Cache the given query keyed by its identifier.
|
void |
clear()
Clears all cached queries.
|
void |
endConfiguration()
Invoked upon completion of bean property configuration for this object.
|
PreparedQuery |
get(String id)
Get the PreparedQuery with the given identifier if it exists. null
otherwise.
|
int |
getCacheSize() |
boolean |
getEnableStatistics()
Affirm if statistics is gathered.
|
List<PreparedQueryCache.Exclusion> |
getExcludes()
Gets the exclusion patterns.
|
Map<String,String> |
getMapView()
Get a map view of the cached queries indexed by identifier.
|
QueryStatistics<String> |
getStatistics()
Gets the simple statistics for executed queries.
|
PreparedQuery |
initialize(String key,
Object result)
Initialize the cached Prepared Query registered with the given
key earlier by the given execution result.
|
boolean |
invalidate(String id)
Remove the PreparedQuery with the given identifier from this cache.
|
Boolean |
isCachable(String id)
Affirms if a PreparedQuery can be cached against the given key.
|
PreparedQueryCache.Exclusion |
isExcluded(String id)
Returns the exclusion status of if the given query key.
|
protected void |
lock(boolean readOnly)
Note: Care needs to be taken so that a read lock is never held while requesting a write lock.
|
PreparedQuery |
markUncachable(String id,
PreparedQueryCache.Exclusion exclusion)
Marks the given key as not amenable to caching.
|
Boolean |
register(String id,
Query query,
FetchConfiguration hints)
Register the given query for caching against the given key if it has not
already been cached.
|
void |
removeExclusionPattern(String pattern)
Removes a pattern for exclusion.
|
void |
setConfiguration(Configuration conf)
Invoked prior to setting bean properties.
|
void |
setEnableStatistics(boolean enable)
Enable/disable gathering of statistics.
|
void |
setExcludes(String excludes)
Sets one or more exclusion regular expression patterns separated by
semicolon.
|
void |
setMaxCacheSize(int size) |
void |
startConfiguration()
Invoked before bean property configuration is begun on this object.
|
protected void |
unlock(boolean readOnly) |
public Boolean register(String id, Query query, FetchConfiguration hints)
PreparedQueryCacheregister in interface PreparedQueryCachepublic Map<String,String> getMapView()
PreparedQueryCachegetMapView in interface PreparedQueryCachepublic boolean cache(PreparedQuery q)
cache in interface PreparedQueryCache#markUncachable(String),
PreparedQueryCache.setExcludes(String),
PreparedQueryCache.addExclusionPattern(String)public PreparedQuery initialize(String key, Object result)
PreparedQueryCacheinitialize in interface PreparedQueryCachekey - the key used during registrationresult - an opaque instance carrying the execution result
of the original query.public boolean invalidate(String id)
PreparedQueryCacheinvalidate in interface PreparedQueryCachepublic PreparedQuery get(String id)
PreparedQueryCacheget in interface PreparedQueryCachepublic Boolean isCachable(String id)
PreparedQueryCacheisCachable in interface PreparedQueryCachepublic PreparedQuery markUncachable(String id, PreparedQueryCache.Exclusion exclusion)
PreparedQueryCachemarkUncachable in interface PreparedQueryCacheid - is the key to be excludedexclusion - directs whether exclusion is irreversible or not.public PreparedQueryCache.Exclusion isExcluded(String id)
PreparedQueryCacheisExcluded in interface PreparedQueryCachepublic void setExcludes(String excludes)
PreparedQueryCachesetExcludes in interface PreparedQueryCachepublic List<PreparedQueryCache.Exclusion> getExcludes()
PreparedQueryCachegetExcludes in interface PreparedQueryCachepublic void addExclusionPattern(String pattern)
addExclusionPattern in interface PreparedQueryCachepublic void removeExclusionPattern(String pattern)
removeExclusionPattern in interface PreparedQueryCachePreparedQueryCache.markUncachable(String, Exclusion)public QueryStatistics<String> getStatistics()
PreparedQueryCachegetStatistics in interface PreparedQueryCacheprotected void lock(boolean readOnly)
readOnly - - If true, a read lock will be acquired. Else a write lock will be acquired.protected void unlock(boolean readOnly)
readOnly - - If true, the read lock will be released. Else a write lock will be released.public void clear()
PreparedQueryCacheclear in interface PreparedQueryCachepublic void setEnableStatistics(boolean enable)
PreparedQueryCachesetEnableStatistics in interface PreparedQueryCachepublic boolean getEnableStatistics()
PreparedQueryCachegetEnableStatistics in interface PreparedQueryCachepublic void setMaxCacheSize(int size)
public int getCacheSize()
public void setConfiguration(Configuration conf)
ConfigurablesetConfiguration in interface Configurablepublic void startConfiguration()
ConfigurablestartConfiguration in interface Configurablepublic void endConfiguration()
ConfigurableendConfiguration in interface ConfigurableCopyright © 2006–2022 Apache Software Foundation. All rights reserved.