getAll method

Future<Map<String, CacheItem>> getAll(
  1. List<String> keys
)

Retrieves multiple CacheItems associated with the given keys.

Returns a map where the keys are the original keys and the values are the retrieved CacheItems. If a key is not found in the cache, it will not be included in the returned map.

Throws a CacheException if there is an error retrieving the data.

Implementation

Future<Map<String, CacheItem<dynamic>>> getAll(List<String> keys) async {
  // Default implementation that calls get for each key
  // Subclasses should override this with a more efficient implementation if possible
  final result = <String, CacheItem<dynamic>>{};
  for (final key in keys) {
    final value = await get(key);
    if (value != null) {
      result[key] = value;
    }
  }
  return result;
}