Package com.microstrategy.utils.cache
Class SimpleHint
- java.lang.Object
-
- com.microstrategy.utils.cache.SimpleHint
-
- All Implemented Interfaces:
CacheHint
- Direct Known Subclasses:
ConfigurationFilesCache.ConfigurationFileCacheHint,EsriWebMapHint,ResourceCacheHint
public class SimpleHint extends java.lang.Object implements CacheHint
SimpleHintis an implementation of theCacheHintinterface. It maintains aMapof cache state IDs keyed by cache names, and provides methods to save and restore this class (seegetState()andrestoreState(String)).
TheSimpleHintcan be used the Cache key as well. It overrides the equals and hashCode methods so the hint becomes the id of the element.- Since:
- MicroStrategy Web 7.3.1 or earlier
-
-
Field Summary
-
Fields inherited from interface com.microstrategy.utils.cache.CacheHint
ZERO_STATE_ID
-
-
Constructor Summary
Constructors Constructor Description SimpleHint()SimpleHint(java.lang.String str)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)java.lang.LonggetCacheStateId(java.lang.String name)Returns a value for the current state of the cache hint This value is used in maintaining cache consistency across different caches using the same hint object (for instance, session based cache across a web cluster where each machine in the cluster holds a copy of the cache) Whenever a change is made to the cached value in one cache, the stateId is incrementedjava.util.MapgetCacheStates()java.lang.StringgetHint()java.lang.StringgetState()Used for persisting cache update counts.inthashCode()voidrestoreState(java.lang.String state)Restore cache update counts.voidsetCacheStateId(java.lang.String name, java.lang.Long stateId)Sets the stateId - seeCacheHint.getCacheStateId(String).protected voidsetHint(java.lang.String str)java.lang.StringtoString()
-
-
-
Method Detail
-
getHint
public java.lang.String getHint()
-
setHint
protected void setHint(java.lang.String str)
- Since:
- MicroStrategy Web 9.0.0
-
getState
public java.lang.String getState()
Used for persisting cache update counts.- Returns:
- A String representation of the hint.
-
restoreState
public void restoreState(java.lang.String state)
Restore cache update counts.- Parameters:
state- A String representation of the state of this hint to restore.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getCacheStateId
public java.lang.Long getCacheStateId(java.lang.String name)
Description copied from interface:CacheHintReturns a value for the current state of the cache hint This value is used in maintaining cache consistency across different caches using the same hint object (for instance, session based cache across a web cluster where each machine in the cluster holds a copy of the cache) Whenever a change is made to the cached value in one cache, the stateId is incremented- Specified by:
getCacheStateIdin interfaceCacheHint- Parameters:
name- cache name- Returns:
- current state of the cache hint
- See Also:
CacheHint.getCacheStateId(String)
-
setCacheStateId
public void setCacheStateId(java.lang.String name, java.lang.Long stateId)Description copied from interface:CacheHintSets the stateId - seeCacheHint.getCacheStateId(String).- Specified by:
setCacheStateIdin interfaceCacheHint- Parameters:
name- cache namestateId- new cache state id- See Also:
CacheHint.setCacheStateId(String, Long)
-
getCacheStates
public java.util.Map getCacheStates()
-
-