public interface CacheInvalidationHelper
Modifier and Type | Method and Description |
---|---|
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.
|
SystemEvent constructEvent(String originalItemId, String entityType, String propertyVal, Long processMarker, String region, Long targetSandBox, Long currentProfile, Long currentCatalog, EventWorkerType workerType)
originalItemId
- entityType
- propertyVal
- processMarker
- region
- targetSandBox
- currentProfile
- currentCatalog
- workerType
- List<EntityCacheRegion> getInvalidationRegions(@Nullable 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[])
. 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
getTypeRegions(Class[])
If both the given property and the list of classes are marked with @Cache then this returns an empty list
IllegalArgumentException
- if the property cannot be found on any class within entityClass#getPropertyRegion(String, Class[])}
,
#getTypeRegions(Class[])}
List<EntityCacheRegion> getTypeRegions(Class<?>[] entityClass)
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:
entityClass
- EntityCacheRegion getPropertyRegion(@Nullable 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
property
- entityClass
- IllegalArgumentException
- if the given property cannot be found on any of entityClassSystemEvent constructRegionEvent(Long processMarker, String region, EventWorkerType workerType)
processMarker
- region
- workerType
- Copyright © 2019. All rights reserved.