Class CachingGenericDao<T extends net.solarnetwork.dao.Entity<K>,K,D extends net.solarnetwork.dao.GenericDao<T,K>>
java.lang.Object
net.solarnetwork.central.common.dao.CachingGenericDao<T,K,D>
- Type Parameters:
T- the entity type managed by this DAOK- the entity primary key typeD- the delegate DAO type
- All Implemented Interfaces:
net.solarnetwork.dao.GenericDao<T,K>
- Direct Known Subclasses:
CachingUserMetadataDao
public class CachingGenericDao<T extends net.solarnetwork.dao.Entity<K>,K,D extends net.solarnetwork.dao.GenericDao<T,K>>
extends Object
implements net.solarnetwork.dao.GenericDao<T,K>
Proxy implementation of
GenericDao with caching support.-
Nested Class Summary
Nested classes/interfaces inherited from interface net.solarnetwork.dao.GenericDao
net.solarnetwork.dao.GenericDao.EntityEventType, net.solarnetwork.dao.GenericDao.StandardSortKey -
Field Summary
FieldsModifier and TypeFieldDescriptionThe cache.protected final DThe delegate DAO.protected final ExecutorA background task executor.Fields inherited from interface net.solarnetwork.dao.GenericDao
ENTITY_EVENT_ENTITY_ID_PROPERTY, ENTITY_EVENT_ENTITY_PROPERTY, ENTITY_EVENT_TOPIC_TEMPLATE, SORT_BY_CREATED_ASCENDING, SORT_BY_CREATED_DESCENDING, SORT_BY_CREATED_ID_ASCENDING, SORT_BY_CREATED_ID_DESCENDING, SORT_BY_ID_ASCENDING, SORT_BY_ID_DESCENDING -
Constructor Summary
ConstructorsConstructorDescriptionCachingGenericDao(D delegate, javax.cache.Cache<K, T> cache, Executor executor) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidentityEventTopic(net.solarnetwork.dao.GenericDao.EntityEventType eventType) protected voidevictKeysMatching(Predicate<K> filter) Evict all keys matching a predicate.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.solarnetwork.dao.GenericDao
entityKey
-
Field Details
-
delegate
The delegate DAO. -
cache
The cache. -
executor
A background task executor.
-
-
Constructor Details
-
CachingGenericDao
Constructor.- Parameters:
delegate- the delegate DAOcache- the cacheexecutor- task executor- Throws:
IllegalArgumentException- if any argument is null
-
-
Method Details
-
entityEventTopic
-
getObjectType
-
save
-
get
-
getAll
-
delete
-
evictKeysMatching
Evict all keys matching a predicate.This method will submit a task to the configured
Executorto perform the eviction, and then return immediately.- Parameters:
filter- the predicate to match keys of entries to evict from the cache
-