Package net.sf.basedb.util.listable
Class TransformCache
java.lang.Object
net.sf.basedb.util.listable.TransformCache
A simple cache implementation for holding the result of source item to target item transformation.
- Since:
- 3.16
- Author:
- nicklas
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<TransformCache.CacheKey,
TransformCache.CacheEntry> private long
private final long
-
Constructor Summary
ConstructorsConstructorDescriptionTransformCache
(int timeoutInMinutes) Creates a new cache with the specified timeout. -
Method Summary
Modifier and TypeMethodDescription(package private) void
clean()
Get a cached entry if.static TransformCache.CacheKey
getKey
(String cacheRegion, Item sourceType, Item targetType, SyncFilter.SourceItemTransform transform, Set<Integer> sourceIds) static TransformCache.CacheKey
getKey
(Item sourceType, Item targetType, SyncFilter.SourceItemTransform transform, Set<Integer> sourceIds) Get a key that is able to identify a given transformation.void
store
(TransformCache.CacheKey key, Set<Integer> targetList) Store a new entry into the cache.
-
Field Details
-
cache
-
timeoutInMillis
private final long timeoutInMillis -
nextCleanup
private long nextCleanup
-
-
Constructor Details
-
TransformCache
public TransformCache(int timeoutInMinutes) Creates a new cache with the specified timeout.
-
-
Method Details
-
getKey
public static TransformCache.CacheKey getKey(Item sourceType, Item targetType, SyncFilter.SourceItemTransform transform, Set<Integer> sourceIds) Get a key that is able to identify a given transformation. We need the source and target item types as well as the transformation direction and all source items ids. It is recommended that the sourceIds set is aSortedSet
. If not, a new sorted set is automatically created. -
getKey
public static TransformCache.CacheKey getKey(String cacheRegion, Item sourceType, Item targetType, SyncFilter.SourceItemTransform transform, Set<Integer> sourceIds) -
get
Get a cached entry if. Null is returned if there is no entry or if the existing entry is too old. -
store
Store a new entry into the cache. -
clean
void clean()
-