Package org.thymeleaf.cache
Class StandardCache<K,V>
java.lang.Object
org.thymeleaf.cache.StandardCache<K,V>
- Type Parameters:
K- The type of the cache keysV- The type of the cache values
- All Implemented Interfaces:
ICache<K,V>
- Since:
- 2.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class(package private) static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StandardCache.CacheDataContainer<K, V> private final booleanprivate final ICacheEntryValidityChecker<? super K, ? super V> private final AtomicLongprivate final AtomicLongprivate longprivate final org.slf4j.Loggerprivate final intprivate final AtomicLongprivate final Stringprivate final AtomicLongprivate static final Stringprivate static final longprivate final booleanprivate final boolean -
Constructor Summary
ConstructorsConstructorDescriptionStandardCache(String name, boolean useSoftReferences, int initialCapacity, int maxSize, org.slf4j.Logger logger) StandardCache(String name, boolean useSoftReferences, int initialCapacity, int maxSize, ICacheEntryValidityChecker<? super K, ? super V> entryValidityChecker, org.slf4j.Logger logger) StandardCache(String name, boolean useSoftReferences, int initialCapacity, int maxSize, ICacheEntryValidityChecker<? super K, ? super V> entryValidityChecker, org.slf4j.Logger logger, boolean enableCounters) StandardCache(String name, boolean useSoftReferences, int initialCapacity, org.slf4j.Logger logger) StandardCache(String name, boolean useSoftReferences, int initialCapacity, ICacheEntryValidityChecker<? super K, ? super V> entryValidityChecker, org.slf4j.Logger logger) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear the entire cache.voidClears a specific entry in the cache.Retrieve a value from the cache.get(K key, ICacheEntryValidityChecker<? super K, ? super V> validityChecker) Retrieve a value from the cache, using the specified validity checker to ensure the entry is still valid.longlongdoubleintlongdoublegetName()longbooleanbooleanprivate voidincrementReportEntity(AtomicLong entity) keySet()Returns all the keys contained in this cache.private voidvoidInsert a new value into the cache.intsize()
-
Field Details
-
REPORT_INTERVAL
private static final long REPORT_INTERVAL- See Also:
-
REPORT_FORMAT
- See Also:
-
lastExecution
private volatile long lastExecution -
name
-
useSoftReferences
private final boolean useSoftReferences -
maxSize
private final int maxSize -
dataContainer
-
entryValidityChecker
-
traceExecution
private final boolean traceExecution -
enableCounters
private final boolean enableCounters -
logger
private final org.slf4j.Logger logger -
getCount
-
putCount
-
hitCount
-
missCount
-
-
Constructor Details
-
StandardCache
public StandardCache(String name, boolean useSoftReferences, int initialCapacity, org.slf4j.Logger logger) -
StandardCache
public StandardCache(String name, boolean useSoftReferences, int initialCapacity, ICacheEntryValidityChecker<? super K, ? super V> entryValidityChecker, org.slf4j.Logger logger) -
StandardCache
public StandardCache(String name, boolean useSoftReferences, int initialCapacity, int maxSize, org.slf4j.Logger logger) -
StandardCache
public StandardCache(String name, boolean useSoftReferences, int initialCapacity, int maxSize, ICacheEntryValidityChecker<? super K, ? super V> entryValidityChecker, org.slf4j.Logger logger) -
StandardCache
public StandardCache(String name, boolean useSoftReferences, int initialCapacity, int maxSize, ICacheEntryValidityChecker<? super K, ? super V> entryValidityChecker, org.slf4j.Logger logger, boolean enableCounters)
-
-
Method Details
-
put
Description copied from interface:ICacheInsert a new value into the cache.
-
get
Description copied from interface:ICacheRetrieve a value from the cache.
-
get
Description copied from interface:ICacheRetrieve a value from the cache, using the specified validity checker to ensure the entry is still valid. If the cache already has a default validity checker, this method should override this setting and use the one specified instead.
-
keySet
Returns all the keys contained in this cache. Note this method might return keys for entries that are already invalid, so the result of calling
get(Object)for these keys might benull. -
clear
public void clear()Description copied from interface:ICacheClear the entire cache.
-
clearKey
Description copied from interface:ICacheClears a specific entry in the cache.
-
getName
-
hasMaxSize
public boolean hasMaxSize() -
getMaxSize
public int getMaxSize() -
getUseSoftReferences
public boolean getUseSoftReferences() -
size
public int size() -
getPutCount
public long getPutCount() -
getGetCount
public long getGetCount() -
getHitCount
public long getHitCount() -
getMissCount
public long getMissCount() -
getHitRatio
public double getHitRatio() -
getMissRatio
public double getMissRatio() -
incrementReportEntity
-
outputReportIfNeeded
private void outputReportIfNeeded()
-