Package com.microstrategy.utils.cache
Interface Cache
-
- All Known Implementing Classes:
BaseGraphStylePropertiesCache
,CacheBase
,ConfigurationFilesCache
,CustomizationsAwareCache
,CustomResourceBundleCache
,DataServerConnectionInfoCache
,EmptySchemaSearchCache
,FileCacheBase
,MapBoxBoundaryCache
,MapShapeCache
,MSIRefreshClusterMembershipCache
,NamedFolderIDCache
,ProjectCacheBase
,PropertiesCache
,RandomNumberMap
,RefineServerPortCache
,RepositorySettingsCache
,ResourceBundleCache
,ResourceCache
,ServerCacheBase
,ServerDefBypassAclCache
,ServerDefCache
,SessionCacheBase
,SysDimensionCache
public interface Cache
Cache interface. Cache is a collection of objects that are loaded from the persistent storage and cached in the memory.- Since:
- MicroStrategy Web 7.3.1 or earlier
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clear()
Clears the cache - all entries are removed.void
close()
Un-register cache from the cache registry.boolean
contains(CacheHint hint)
void
delete(CacheHint hint)
Removes object from the cache and persistent storagejava.lang.Object
get(CacheHint hint)
Finds and returns cached object based on the hint.java.lang.String
getName()
Returns cache name.void
onHintClose(CacheHint hint)
This method is supposed to be called by the hint object when it is closed.void
put(CacheHint hint, java.lang.Object ob)
Puts the object in the cache.java.lang.Object
refresh(CacheHint hint)
Re-loads object from the persistent storagevoid
remove(CacheHint hint)
Removes an object from the cache.void
save(CacheHint hint, java.lang.Object ob)
Puts the object in the cache and stores it in the memory.
-
-
-
Method Detail
-
getName
java.lang.String getName()
Returns cache name.- Returns:
- cache name.
-
get
java.lang.Object get(CacheHint hint) throws CacheException
Finds and returns cached object based on the hint. If object does not exists in the memory it will be loaded from the persistent memory. Returns null if object does not exists in persistent memory either.- Parameters:
hint
- the hint object.- Returns:
- cached object.
- Throws:
CacheException
- if attempt to load object from the persistent memory faild with exception
-
put
void put(CacheHint hint, java.lang.Object ob) throws CacheException
Puts the object in the cache. If cache already contains object corresponding to the specified hint it will be replaced with the new one.- Parameters:
hint
- the hint object.ob
- object to be cached- Throws:
CacheException
- if attempt to extract key from the hint failed
-
remove
void remove(CacheHint hint) throws CacheException
Removes an object from the cache.- Parameters:
hint
- the hint object.- Throws:
CacheException
- Thrown when error occurs during removing the object.
-
save
void save(CacheHint hint, java.lang.Object ob) throws CacheException
Puts the object in the cache and stores it in the memory. Normally this method will be called after application obtained an object from the cache and modified it. But it is also possible to use this method to replace cached object with another one or to add to the cache and to the persistent storage a new object.- Parameters:
hint
- the hint object.ob
- object to be cached- Throws:
CacheException
- if attempt to extract key from the hint failed or if attempt to store obect in the persistent storage failed
-
delete
void delete(CacheHint hint) throws CacheException
Removes object from the cache and persistent storage- Parameters:
hint
- the hint object.- Throws:
CacheException
- if attempt to extract key from the hint failed or if attempt to remove obect from the persistent storage failed
-
refresh
java.lang.Object refresh(CacheHint hint) throws CacheException
Re-loads object from the persistent storage- Parameters:
hint
- the hint object.- Returns:
- cached object. Different cache implementations can either re-load data in the existing object or create a new one.
- Throws:
CacheException
- if attempt to extract key from the hint failed or if attempt to re-load obect from the persistent storage failed
-
close
void close()
Un-register cache from the cache registry. Cache shall not be used after this call.- Since:
- MicroStrategy Web 8.0.0
-
onHintClose
void onHintClose(CacheHint hint)
This method is supposed to be called by the hint object when it is closed. Cache implementations shall use this call to perform proper cache cleanup.- Parameters:
hint
- the hint object.
-
clear
void clear()
Clears the cache - all entries are removed.- Since:
- MicroStrategy Web 7.5.1
-
contains
boolean contains(CacheHint hint) throws CacheException
- Throws:
CacheException
-
-