@Service(value="blCacheInvalidationHelper") public class CacheInvalidationHelperImpl extends Object implements CacheInvalidationHelper
Modifier and Type | Field and Description |
---|---|
protected javax.persistence.EntityManager |
em |
protected org.broadleafcommerce.common.persistence.EntityConfiguration |
entityConfiguration |
Constructor and Description |
---|
CacheInvalidationHelperImpl() |
Modifier and Type | Method and Description |
---|---|
protected void |
addEventDetail(SystemEvent event,
String name,
String value) |
SystemEvent |
constructEvent(String originalItemId,
String entityType,
String propertyVal,
Long processMarker,
String region,
Long targetSandBox,
Long currentProfile,
Long currentCatalog,
EventWorkerType workerType)
Create a cache invalidation event
|
SystemEvent |
constructRegionEvent(Long processMarker,
String region,
EventWorkerType workerType)
Create a cache invalidation event to invalidate an entire cache region
|
List<EntityCacheRegion> |
getInvalidationRegions(String property,
Class<?>[] entityClass)
If the given property is not empty or and the given property is annotated with @Cache this will
return the result of
#getPropertyRegion(property, Class[]) . |
EntityCacheRegion |
getPropertyRegion(String property,
Class<?>[] entityClass)
Inspects the property for the given entityClass to look for an @Cache annotation marking the region
in which this property is cached
|
List<EntityCacheRegion> |
getTypeRegions(Class<?>[] entityClass)
Walks up the hierarchies of the given classes looking @Cache annotation values.
|
protected javax.persistence.EntityManager em
protected org.broadleafcommerce.common.persistence.EntityConfiguration entityConfiguration
public SystemEvent constructEvent(String originalItemId, String entityType, String propertyVal, Long processMarker, String region, Long targetSandBox, Long currentProfile, Long currentCatalog, EventWorkerType workerType)
CacheInvalidationHelper
constructEvent
in interface CacheInvalidationHelper
protected void addEventDetail(SystemEvent event, String name, String value)
public SystemEvent constructRegionEvent(Long processMarker, String region, EventWorkerType workerType)
CacheInvalidationHelper
constructRegionEvent
in interface CacheInvalidationHelper
public List<EntityCacheRegion> getInvalidationRegions(String property, Class<?>[] entityClass)
CacheInvalidationHelper
If the given property is not empty or and the given property is annotated with @Cache this will
return the result of #getPropertyRegion(property, Class[])
. In this case the returned list will be a
single-element
If the given property is empty or is not annotated with @Cache then this will return the result of
CacheInvalidationHelper.getTypeRegions(Class[])
If both the given property and the list of classes are marked with @Cache then this returns an empty list
getInvalidationRegions
in interface CacheInvalidationHelper
#getPropertyRegion(String, Class[])}
,
#getTypeRegions(Class[])}
public EntityCacheRegion getPropertyRegion(String property, Class<?>[] entityClass)
CacheInvalidationHelper
Inspects the property for the given entityClass to look for an @Cache annotation marking the region in which this property is cached
getPropertyRegion
in interface CacheInvalidationHelper
public List<EntityCacheRegion> getTypeRegions(Class<?>[] entityClass)
CacheInvalidationHelper
Walks up the hierarchies of the given classes looking @Cache annotation values. For each one that is found, a list is built up of the region specified in the @Cache annotation and which fully-qualified type that it was found on. This is used to construct the eviction key for Hibernate.
This is designed to work in the following scenarios:
getTypeRegions
in interface CacheInvalidationHelper
Copyright © 2019. All rights reserved.