-
public interface CacheInterface used to interact with the second-level cache. If no second-level cache is in use, the methods of this interface have no effect, except forcontains(java.lang.Class<?>, java.lang.Object), which returns false.- Since:
- 2.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancontains(java.lang.Class<?> cls, java.lang.Object primaryKey)Whether the cache contains data for the given entity.voidevict(java.lang.Class<?> cls)Remove the data for entities of the specified class (and its subclasses) from the cache.voidevict(java.lang.Class<?> cls, java.lang.Object primaryKey)Remove the data for the given entity from the cache.voidevictAll()Clear the cache.<T> Tunwrap(java.lang.Class<T> cls)Return an object of the specified type to allow access to the provider-specific API.
-
-
-
Method Detail
-
contains
boolean contains(java.lang.Class<?> cls, java.lang.Object primaryKey)Whether the cache contains data for the given entity.- Parameters:
cls- entity classprimaryKey- primary key- Returns:
- boolean indicating whether the entity is in the cache
-
evict
void evict(java.lang.Class<?> cls, java.lang.Object primaryKey)Remove the data for the given entity from the cache.- Parameters:
cls- entity classprimaryKey- primary key
-
evict
void evict(java.lang.Class<?> cls)
Remove the data for entities of the specified class (and its subclasses) from the cache.- Parameters:
cls- entity class
-
evictAll
void evictAll()
Clear the cache.
-
unwrap
<T> T unwrap(java.lang.Class<T> cls)
Return an object of the specified type to allow access to the provider-specific API. If the provider's implementation of theCacheinterface does not support the specified class, thePersistenceExceptionis thrown.- Parameters:
cls- the class of the object to be returned. This is usually either the underlying class implementingCache, or an interface it implements.- Returns:
- an instance of the specified type
- Throws:
PersistenceException- if the provider does not support the given type- Since:
- 2.1
-
-