Class GroovySelectorCacheConfiguration
java.lang.Object
ch.tocco.nice2.scripting.impl.groovy.selector.GroovySelectorCacheConfiguration
- All Implemented Interfaces:
EntityCacheConfiguration<SelectorKey,
Boolean>
@Component
public class GroovySelectorCacheConfiguration
extends Object
implements EntityCacheConfiguration<SelectorKey,Boolean>
This cache caches the results of
Selector.isSelected(RelationModel, EntityReference, EntityReference)
.
Note: the cache is valid for the duration of a transaction and the results may become invalid if the Entity
changes.
However, in practice this does not really happen and Selector.isSelected(RelationModel, EntityReference, EntityReference)
is called
unnecessarily often (from the netui plugin), which inefficient.
As we would like to remove the Selector concept anyway, this seems to be the best compromise.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfindKeysToExpire
(com.google.common.cache.Cache<SelectorKey, Boolean> cache, Entity invalidatedEntity) invalidate a cache entrygetName()
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
GroovySelectorCacheConfiguration
public GroovySelectorCacheConfiguration()
-
-
Method Details
-
getName
- Specified by:
getName
in interfaceEntityCacheConfiguration<SelectorKey,
Boolean> - Returns:
- unique name of the cache type
-
findKeysToExpire
public Collection<SelectorKey> findKeysToExpire(com.google.common.cache.Cache<SelectorKey, Boolean> cache, Entity invalidatedEntity) Description copied from interface:EntityCacheConfiguration
invalidate a cache entry- Specified by:
findKeysToExpire
in interfaceEntityCacheConfiguration<SelectorKey,
Boolean> - Returns:
- all keys that should be removed from the cache (because they belong to the given invalidated entity)
-