Class DefaultCachingStrategy
- java.lang.Object
-
- de.iip_ecosphere.platform.connectors.DefaultCachingStrategy
-
- All Implemented Interfaces:
CachingStrategy
public class DefaultCachingStrategy extends java.lang.Object implements CachingStrategy
A default caching strategy.- Author:
- Holger Eichelberger, SSE
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceDefaultCachingStrategy.ConsideredSameA functor indicating that two objects are considered the same.
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.Object>cacheprivate ConnectorParameter.CacheModemodeprivate java.lang.ObjectsingleCache
-
Constructor Summary
Constructors Constructor Description DefaultCachingStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckCache(java.lang.Object data)Checks the cache if configured.booleancheckCache(java.lang.String key, java.lang.Object data)Checks a multi-cache if configured.private booleancheckCache(java.lang.String key, java.lang.Object data, DefaultCachingStrategy.ConsideredSame same)Checks the cache.voidclearCache()Clears the cache.voidsetCacheMode(ConnectorParameter.CacheMode mode)Defines the actual cache mode.
-
-
-
Field Detail
-
singleCache
private java.lang.Object singleCache
-
cache
private java.util.Map<java.lang.String,java.lang.Object> cache
-
mode
private ConnectorParameter.CacheMode mode
-
-
Method Detail
-
setCacheMode
public void setCacheMode(ConnectorParameter.CacheMode mode)
Description copied from interface:CachingStrategyDefines the actual cache mode.- Specified by:
setCacheModein interfaceCachingStrategy- Parameters:
mode- the actual cache mode
-
checkCache
public boolean checkCache(java.lang.Object data)
Description copied from interface:CachingStrategyChecks the cache if configured.- Specified by:
checkCachein interfaceCachingStrategy- Parameters:
data- the data to send- Returns:
truefor sendingdata,falsefor not sendingdata
-
checkCache
public boolean checkCache(java.lang.String key, java.lang.Object data)Description copied from interface:CachingStrategyChecks a multi-cache if configured.- Specified by:
checkCachein interfaceCachingStrategy- Parameters:
key- a key into the cachedata- the data to send- Returns:
truefor sendingdata,falsefor not sendingdata
-
checkCache
private boolean checkCache(java.lang.String key, java.lang.Object data, DefaultCachingStrategy.ConsideredSame same)Checks the cache.- Parameters:
key- the AAS id to consider caches for different AASdata- the data to sendsame- a functor checking the data- Returns:
truefor sendingdata,falsefor not sendingdata
-
clearCache
public void clearCache()
Description copied from interface:CachingStrategyClears the cache.- Specified by:
clearCachein interfaceCachingStrategy
-
-