Constructor and Description |
---|
CacheImpl(EntityManagerFactoryDelegate emf) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
ADVANCED:
Resets the entire Object cache, and the Query cache.
|
void |
clear(java.lang.Class cls)
ADVANCED:
Resets the cache for only the instances of the given Class type.
|
void |
clearQueryCache()
Clear all the query results caches.
|
void |
clearQueryCache(java.lang.Class entityClass)
Clear all named query results cache associated with entity class.
|
void |
clearQueryCache(java.lang.String queryName)
Clear the named query results cache associated with the query name.
|
boolean |
contains(java.lang.Class cls,
java.lang.Object id)
Returns true if the cache contains an Object with the id and Class type, and is valid.
|
boolean |
contains(java.lang.Object object)
Returns true if the cache contains an Object with the same id and Class type of the given object.
|
void |
evict(java.lang.Class entityOrMappedSuperclassToEvict)
Sets all instances of the class to be invalid.
|
void |
evict(java.lang.Class classToEvict,
java.lang.Object id)
Sets an Object with the id and Class type to be invalid in the cache.
|
void |
evict(java.lang.Class classToEvict,
java.lang.Object id,
boolean invalidateInCluster)
Sets an Object with the id and Class type to be invalid in the cache.
|
void |
evict(java.lang.Object object)
Sets the object to be invalid in the cache.
|
void |
evict(java.lang.Object object,
boolean invalidateInCluster)
Sets an Object to be invalid in the cache.
|
void |
evictAll()
Sets all instances in the cache to be invalid.
|
java.lang.Object |
getId(java.lang.Object object)
This method will return the objects's Id.
|
java.lang.Object |
getObject(java.lang.Class cls,
java.lang.Object id)
Returns the Object from the cache map with the id
and Class type.
|
boolean |
isValid(java.lang.Class cls,
java.lang.Object id)
Returns true if the Object with the id and Class type is valid in the cache.
|
boolean |
isValid(java.lang.Object object)
Returns true if the Object with the same id and Class type of the
the given Object is valid in the cache.
|
void |
print()
Used to print all the Objects in the cache.
|
void |
print(java.lang.Class cls)
Used to print all the Objects in the cache of the Class type.
|
void |
printLocks()
Used to print all the currently locked cache keys in the cache.
|
java.lang.Object |
putObject(java.lang.Object object)
ADVANCED:
Puts the given Object into the cache.
|
java.lang.Object |
removeObject(java.lang.Class cls,
java.lang.Object id)
ADVANCED:
Removes the Object with the id and Class type from the cache.
|
java.lang.Object |
removeObject(java.lang.Object object)
ADVANCED:
Removes the Object from the cache.
|
long |
timeToLive(java.lang.Object object)
Returns the remaining life of the given Object (in milliseconds).
|
<T> T |
unwrap(java.lang.Class<T> cls) |
void |
validate()
This can be used to help debugging an Object identity problem.
|
public CacheImpl(EntityManagerFactoryDelegate emf)
emf
- public boolean contains(java.lang.Class cls, java.lang.Object id)
contains
in interface javax.persistence.Cache
Cache.contains(Class, Object)
public void evict(java.lang.Class classToEvict, java.lang.Object id)
If the class is a MappedSuperclass then the first entity above in the inheritance hierarchy will be evicted along with all implementing subclasses If the class is not an Entity or MappedSuperclass but is the root of an entity inheritance tree then evict the subtree If the class is not an Entity or MappedSuperclass but inherits from one then evict up to root descriptor
evict
in interface javax.persistence.Cache
classToEvict
- - class to evict - usually representing an Entity or MappedSuperclassid
- - Primary key of the Entity or MappedSuperclass Class
A null id means invalidate the class - possibly the entire tree or subtreeCache.evict(Class, Object)
public void evict(java.lang.Class classToEvict, java.lang.Object id, boolean invalidateInCluster)
If the class is a MappedSuperclass then the first entity above in the inheritance hierarchy will be evicted along with all implementing subclasses If the class is not an Entity or MappedSuperclass but is the root of an entity inheritance tree then evict the subtree If the class is not an Entity or MappedSuperclass but inherits from one then evict up to root descriptor
evict
in interface JpaCache
classToEvict
- - class to evict - usually representing an Entity or MappedSuperclassid
- - Primary key of the Entity or MappedSuperclass Class
A null id means invalidate the class - possibly the entire tree or subtreeinvalidateInCluster
- - Invalidate the object id in the cluster, this only applies to a non-null id.Cache.evict(Class, Object)
public void evict(java.lang.Class entityOrMappedSuperclassToEvict)
If the class is a MappedSuperclass then the first entity above in the inheritance hierarchy will be evicted along with all implementing subclasses If the class is not an Entity or MappedSuperclass (such as an Embeddable or plain java class) - nothing will be evicted
evict
in interface javax.persistence.Cache
entityOrMappedSuperclassToEvict
- - Entity or MappedSuperclass ClassCache.evict(Class)
public void evictAll()
evictAll
in interface javax.persistence.Cache
Cache#evict(Object)
public void clear()
NOTE: Be careful using this method. This method blows away both this session's and its parent's caches. This includes the server cache or any other cache. This throws away any Objects that have been read in. Extreme caution should be used before doing this because Object identity will no longer be maintained for any Objects currently read in. This should only be called if the application knows that it no longer has references to Objects held in the cache.
public void clear(java.lang.Class cls)
NOTE: Caution must be used in doing this to ensure that the Objects within the cache are not referenced from other Objects of other classes or from the application.
public void clearQueryCache()
clearQueryCache
in interface JpaCache
public void clearQueryCache(java.lang.String queryName)
clearQueryCache
in interface JpaCache
public void clearQueryCache(java.lang.Class entityClass)
clearQueryCache
in interface JpaCache
public long timeToLive(java.lang.Object object)
timeToLive
in interface JpaCache
public boolean isValid(java.lang.Object object)
public boolean isValid(java.lang.Class cls, java.lang.Object id)
public void print()
public void print(java.lang.Class cls)
public void printLocks()
printLocks
in interface JpaCache
public void validate()
public java.lang.Object getObject(java.lang.Class cls, java.lang.Object id)
public java.lang.Object putObject(java.lang.Object object)
public java.lang.Object removeObject(java.lang.Object object)
NOTE: Caution should be used when calling to avoid violating Object identity. The application should only call this if its known that no references to the Object exist.
removeObject
in interface JpaCache
public java.lang.Object removeObject(java.lang.Class cls, java.lang.Object id)
NOTE: Caution should be used when calling to avoid violating Object identity. The application should only call this if its known that no references to the Object exist.
removeObject
in interface JpaCache
public boolean contains(java.lang.Object object)
public void evict(java.lang.Object object)
evict
in interface JpaCache
JpaCache.evict(Object)
public void evict(java.lang.Object object, boolean invalidateInCluster)
public java.lang.Object getId(java.lang.Object object)
public <T> T unwrap(java.lang.Class<T> cls)
unwrap
in interface javax.persistence.Cache
EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference