org.eclipse.persistence.queries.ReadQuery#setQueryResultsCachePolicy(QueryResultsCachePolicy)
| Modifier and Type | Field and Description |
|---|---|
| protected Class | cacheType
Allows the identity map class type to be set. |
| protected boolean | invalidateOnChange
Allows the query cache to be invalidated when any object of any of the query classes is modified. |
| protected Set | invalidationClasses
Stores the set of classes that should trigger the query cached results to be invalidated. |
| protected CacheInvalidationPolicy | invalidationPolicy
Allows invalidation to be specified. |
| protected boolean | isNullIgnored
Allows the caching of null to be configured. |
| protected int | maximumResultSets
Specifies the cache size. |
| Access | Constructor and Description |
|---|---|
| public | QueryResultsCachePolicy()
PUBLIC: Build a QueryResultsCachePolicy with the default settings By default there is no invalidation of query results and the maximum number of results sets is 100. |
| public | QueryResultsCachePolicy(CacheInvalidationPolicy policy, int maximumResultSets)
PUBLIC: Build a QueryResultsCachePolicy and supply a CacheInvalidationPolicy and a maximum number of results sets. |
| public | QueryResultsCachePolicy(CacheInvalidationPolicy policy)
PUBLIC: Build a QueryResultsCachePolicy and supply a CacheInvalidationPolicy. |
| public | QueryResultsCachePolicy(int maximumResultSets)
PUBLIC: Build a QueryResultsCachePolicy and supply a maximum for the number of results sets. |
| Modifier and Type | Method and Description |
|---|---|
| public QueryResultsCachePolicy | |
| public CacheInvalidationPolicy | |
| public Class | |
| public boolean | getInvalidateOnChange()
PUBLIC: Return if any change to any object of the query class should cause the query results to be invalidated. |
| public Set | getInvalidationClasses()
ADVANCED: Return the set of classes that should trigger the query cached results to be invalidated. |
| public int | |
| public boolean | |
| public void | setCacheInvalidationPolicy(CacheInvalidationPolicy invalidationPolicy)
PUBLIC: Set the query cache invalidation policy. |
| public void | setCacheType(Class<? extends IdentityMap> cacheType)
PUBLIC: Set the type of the cache used for the query results. |
| public void | setInvalidateOnChange(boolean invalidateOnChange)
PUBLIC: Configure if any change to any object of the query class should cause the query results to be invalidated. |
| public void | setInvalidationClasses(Set<Class<?>> invalidationClasses)
ADVANCED: Set the set of classes that should trigger the query cached results to be invalidated. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | useSoftLRUCache()
PUBLIC: Set the type of the cache used for the query results to a SoftCacheWeakIdentityMap. |
| cacheType | back to summary |
|---|---|
| protected Class<? extends IdentityMap> cacheType Allows the identity map class type to be set. | |
| invalidateOnChange | back to summary |
|---|---|
| protected boolean invalidateOnChange Allows the query cache to be invalidated when any object of any of the query classes is modified. | |
| invalidationClasses | back to summary |
|---|---|
| protected Set<Class<?>> invalidationClasses Stores the set of classes that should trigger the query cached results to be invalidated. | |
| invalidationPolicy | back to summary |
|---|---|
| protected CacheInvalidationPolicy invalidationPolicy Allows invalidation to be specified. | |
| isNullIgnored | back to summary |
|---|---|
| protected boolean isNullIgnored Allows the caching of null to be configured. | |
| maximumResultSets | back to summary |
|---|---|
| protected int maximumResultSets Specifies the cache size. | |
| QueryResultsCachePolicy | back to summary |
|---|---|
| public QueryResultsCachePolicy() PUBLIC: Build a QueryResultsCachePolicy with the default settings By default there is no invalidation of query results and the maximum number of results sets is 100. | |
| QueryResultsCachePolicy | back to summary |
|---|---|
| public QueryResultsCachePolicy(CacheInvalidationPolicy policy, int maximumResultSets) PUBLIC: Build a QueryResultsCachePolicy and supply a CacheInvalidationPolicy and a maximum number of results sets. | |
| QueryResultsCachePolicy | back to summary |
|---|---|
| public QueryResultsCachePolicy(CacheInvalidationPolicy policy) PUBLIC: Build a QueryResultsCachePolicy and supply a CacheInvalidationPolicy. The default value of 100 will be used for the maximum number of result sets | |
| QueryResultsCachePolicy | back to summary |
|---|---|
| public QueryResultsCachePolicy(int maximumResultSets) PUBLIC: Build a QueryResultsCachePolicy and supply a maximum for the number of results sets. Results will be set not to expire in the cache. | |
| clone | back to summary |
|---|---|
| public QueryResultsCachePolicy clone() Overrides java. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by
| |
| getCacheInvalidationPolicy | back to summary |
|---|---|
| public CacheInvalidationPolicy getCacheInvalidationPolicy() PUBLIC: Return the query cache invalidation policy. The cache invalidation policy defines how the query results are invalidated. | |
| getCacheType | back to summary |
|---|---|
| public Class PUBLIC: Return the type of the cache used for the query results. This defaults to a LRU cache (CacheIdentityMap), but can be set to any IdentityMap class, such as Full or Soft. | |
| getInvalidateOnChange | back to summary |
|---|---|
| public boolean getInvalidateOnChange() PUBLIC: Return if any change to any object of the query class should cause the query results to be invalidated. | |
| getInvalidationClasses | back to summary |
|---|---|
| public Set ADVANCED: Return the set of classes that should trigger the query cached results to be invalidated. | |
| getMaximumCachedResults | back to summary |
|---|---|
| public int getMaximumCachedResults() PUBLIC: Return the maximum cached results. This defines the number of query result sets that will be cached. The LRU query results will be discarded when the max size is reached. | |
| isNullIgnored | back to summary |
|---|---|
| public boolean isNullIgnored() PUBLIC: Return if null results should be cached or ignored. By default they are cached. They can be ignored to allow a query cache to be used as a secondary cache index, and allow new objects to be insert, and still found. | |
| setCacheInvalidationPolicy | back to summary |
|---|---|
| public void setCacheInvalidationPolicy(CacheInvalidationPolicy invalidationPolicy) PUBLIC: Set the query cache invalidation policy. The cache invalidation policy defines how the query results are invalidated. | |
| setCacheType | back to summary |
|---|---|
| public void setCacheType(Class<? extends IdentityMap> cacheType) PUBLIC: Set the type of the cache used for the query results. This defaults to a LRU cache (CacheIdentityMap), but can be set to any IdentityMap class, such as Full or Soft. | |
| setInvalidateOnChange | back to summary |
|---|---|
| public void setInvalidateOnChange(boolean invalidateOnChange) PUBLIC: Configure if any change to any object of the query class should cause the query results to be invalidated. | |
| setInvalidationClasses | back to summary |
|---|---|
| public void setInvalidationClasses(Set<Class<?>> invalidationClasses) ADVANCED: Set the set of classes that should trigger the query cached results to be invalidated. This is normally computed by the query, but can be set in the case of native queries. | |
| setIsNullIgnored | back to summary |
|---|---|
| public void setIsNullIgnored(boolean isNullIgnored) PUBLIC: Set if null results should be cached or ignored. By default they are cached. They can be ignored to allow a query cache to be used as a secondary cache index, and allow new objects to be insert, and still found. | |
| setMaximumCachedResults | back to summary |
|---|---|
| public void setMaximumCachedResults(int maximumResultSets) PUBLIC: Set the maximum cached results. This defines the number of query result sets that will be cached. The LRU query results will be discarded when the max size is reached. | |
| useFullCache | back to summary |
|---|---|
| public void useFullCache() PUBLIC: Set the type of the cache used for the query results to a FullIdentityMap. This will cache all query results, so caution should be used to avoid running out of memory. | |
| useLRUCache | back to summary |
|---|---|
| public void useLRUCache() PUBLIC: Set the type of the cache used for the query results to a CacheIdentityMap. This will uses a fixed size LRU cache. This is the default. | |
| useSoftCache | back to summary |
|---|---|
| public void useSoftCache() PUBLIC: Set the type of the cache used for the query results to a SoftIdentityMap. This will cache all query results, unless the JVM believes memory is low. | |
| useSoftLRUCache | back to summary |
|---|---|
| public void useSoftLRUCache() PUBLIC: Set the type of the cache used for the query results to a SoftCacheWeakIdentityMap. This will uses a fixed size LRU cache using Soft references, so will allow garbage collection when memory is low. | |