Interface CacheService
-
- All Implemented Interfaces:
public interface CacheServiceRepresents a component that facilitates caching.
-
-
Method Summary
Modifier and Type Method Description abstract booleanset(@NonNull() String cacheName, @NonNull() String key, @NonNull() CacheEntry value)Creates or updates the key-value pair in the cache. abstract CacheResultget(@NonNull() String cacheName, @NonNull() String key)Retrieves the item associated with the key from the cache. abstract booleanremove(@NonNull() String cacheName, @NonNull() String key)Removes the item associated with the key from the cache. -
-
Method Detail
-
set
abstract boolean set(@NonNull() String cacheName, @NonNull() String key, @NonNull() CacheEntry value)
Creates or updates the key-value pair in the cache.
- Parameters:
cacheName- name of the cache where the cache entry is to be createdkey- key for the item to be cachedvalue- the value that is to be associated withkey
-
get
@Nullable() abstract CacheResult get(@NonNull() String cacheName, @NonNull() String key)
Retrieves the item associated with the key from the cache.
- Parameters:
cacheName- name of the cache where the key should be queried fromkey- key for the cache entry- Returns:
a valid cache entry for the key if one exists; null otherwise.
-
remove
abstract boolean remove(@NonNull() String cacheName, @NonNull() String key)
Removes the item associated with the key from the cache.
- Parameters:
cacheName- name of the cache where the item is to be removed fromkey- the key for the item that is to be removed- Returns:
true if the item has been removed; false otherwise.
-
-
-
-