getAll method
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
@override
Future<Map<String, CacheItem<dynamic>>> getAll(List<String> keys) async {
final result = <String, CacheItem<dynamic>>{};
for (final key in keys) {
if (_cache.containsKey(key)) {
final dynamic storedValue = _cache[key];
if (storedValue == null) continue;
if (enableEncryption) {
final decryptedValue = _decrypt(storedValue);
result[key] = CacheItem.fromJson(jsonDecode(decryptedValue));
} else {
result[key] = storedValue as CacheItem<dynamic>;
}
}
}
return result;
}