Interface CacheManager<T>
public interface CacheManager<T>
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()clear plugins cachebooleanClear plugins cache.Returns a populated #Optionalif the value exists, otherwise Optional.empty().Get or load a value by supplying a key, value, and function.Get or load a value by supplying a key and function.voidInitialize cache for pluginTypeinvalidate(String key) Invalidates, or removes the associated cache entry.Populate a cache with value.
-
Method Details
-
init
Initialize cache for pluginType- Parameters:
pluginType- pluginType
-
get
Returns a populated #Optionalif the value exists, otherwise Optional.empty().- Parameters:
key- key- Returns:
- The return value.
-
put
Populate a cache with value.- Parameters:
key- keyvalue- value- Returns:
- The return value is previous value.
-
get
Get or load a value by supplying a key and function. The function is provided an #Optional, representing the existing value, if any.- Parameters:
key- keyloader- loader- Returns:
- existing or new value
-
get
Get or load a value by supplying a key, value, and function. The bi function can access existing value and produce new value from it.- Parameters:
key- keyloader- bi function loader- Returns:
- null if key is not present, otherwise return new value
-
invalidate
Invalidates, or removes the associated cache entry.- Parameters:
key- key- Returns:
- Returns a populated #
Optionalif the entry existed, otherwise Optional.empty().
-
contains
Clear plugins cache.- Parameters:
key- key- Returns:
- boolean value indicating whether cache contains key or not
-
clear
void clear()clear plugins cache
-