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
SimpleHint
is an implementation of theCacheHint
interface. It maintains aMap
of cache state IDs keyed by cache names, and provides methods to save and restore this class (seegetState()
andrestoreState(String)
).
TheSimpleHint
can 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 boolean
equals(java.lang.Object obj)
java.lang.Long
getCacheStateId(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.Map
getCacheStates()
java.lang.String
getHint()
java.lang.String
getState()
Used for persisting cache update counts.int
hashCode()
void
restoreState(java.lang.String state)
Restore cache update counts.void
setCacheStateId(java.lang.String name, java.lang.Long stateId)
Sets the stateId - seeCacheHint.getCacheStateId(String)
.protected void
setHint(java.lang.String str)
java.lang.String
toString()
-
-
-
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:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getCacheStateId
public java.lang.Long getCacheStateId(java.lang.String name)
Description copied from interface:CacheHint
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 incremented- Specified by:
getCacheStateId
in 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:CacheHint
Sets the stateId - seeCacheHint.getCacheStateId(String)
.- Specified by:
setCacheStateId
in interfaceCacheHint
- Parameters:
name
- cache namestateId
- new cache state id- See Also:
CacheHint.setCacheStateId(String, Long)
-
getCacheStates
public java.util.Map getCacheStates()
-
-