Package com.helixframework.cache
Class BaseCacheService<K,V>
java.lang.Object
com.helixframework.cache.BaseCacheService<K,V>
- All Implemented Interfaces:
CacheService<K,V>
-
Constructor Summary
ConstructorsConstructorDescriptionBaseCacheService(io.micrometer.core.instrument.MeterRegistry meterRegistry) BaseCacheService(String name) BaseCacheService(String name, io.micrometer.core.instrument.MeterRegistry meterRegistry) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all entries from the cache.protected abstract voiddoClear()protected abstract voidprotected abstract voidprotected abstract voidvoidRemoves the cache entry associated with the specified key.Retrieves the value associated with the specified key from the cache, if present.getName()Generates a formatted name for the class by splitting its simple name at camel case boundaries and joining the segments with underscores, then converting the resulting string to lowercase.voidStores a key-value pair in the cache.voidStores a key-value pair in the cache with an optional time-to-live (TTL) duration.
-
Constructor Details
-
BaseCacheService
-
BaseCacheService
public BaseCacheService(io.micrometer.core.instrument.MeterRegistry meterRegistry) -
BaseCacheService
-
-
Method Details
-
get
Description copied from interface:CacheServiceRetrieves the value associated with the specified key from the cache, if present.- Specified by:
getin interfaceCacheService<K,V> - Parameters:
key- the key whose associated value is to be returned- Returns:
- an
Optionalcontaining the value associated with the specified key, or an emptyOptionalif the key is not present in the cache
-
put
Description copied from interface:CacheServiceStores a key-value pair in the cache. If the key already exists, the associated value is replaced with the new value.- Specified by:
putin interfaceCacheService<K,V> - Parameters:
key- the key with which the specified value is to be associated; must not be nullvalue- the value to be associated with the specified key; may be null
-
put
Description copied from interface:CacheServiceStores a key-value pair in the cache with an optional time-to-live (TTL) duration. If the key already exists, the associated value is replaced with the new value, and the TTL is updated. The TTL specifies the duration for which the entry remains in the cache.- Specified by:
putin interfaceCacheService<K,V> - Parameters:
key- the key with which the specified value is to be associated; must not be nullvalue- the value to be associated with the specified key; may be nullttl- the time-to-live duration for the cache entry; must not be null
-
evict
Description copied from interface:CacheServiceRemoves the cache entry associated with the specified key. If the key does not exist in the cache, no action is taken.- Specified by:
evictin interfaceCacheService<K,V> - Parameters:
key- the key of the cache entry to be removed; must not be null
-
clear
public void clear()Description copied from interface:CacheServiceRemoves all entries from the cache. After this operation, the cache will be empty.- Specified by:
clearin interfaceCacheService<K,V>
-
getName
Description copied from interface:CacheServiceGenerates a formatted name for the class by splitting its simple name at camel case boundaries and joining the segments with underscores, then converting the resulting string to lowercase.- Specified by:
getNamein interfaceCacheService<K,V> - Returns:
- the formatted name of the class
-
doGet
-
doPut
-
doPut
-
doEvict
-
doClear
protected abstract void doClear()
-