Interface CacheLoader
public interface CacheLoader
Interface for loading cache data from external sources.
Implementations provide custom logic to load keys and values from various sources
(databases, files, external APIs, etc.) during cache warming.
-
Method Summary
Modifier and TypeMethodDescriptionlongGet the total number of available keys in the external source.getKeys(long offset, long limit) Get a batch of keys from the external source for bulk loading.Load values for the given keys from an external source.
-
Method Details
-
loadKeys
Load values for the given keys from an external source.- Parameters:
keys- the list of keys to load- Returns:
- a map of key -> value pairs that were successfully loaded. Keys not found in the external source should be omitted.
- Throws:
Exception- if loading fails
-
getKeyCount
-
getKeys
Get a batch of keys from the external source for bulk loading. Used to discover available keys during warming when keys are not pre-specified.- Parameters:
offset- the starting offset for paginationlimit- the maximum number of keys to return- Returns:
- a list of keys, or empty list if no more keys
- Throws:
Exception- if fetching fails
-