getAll method
Returns all cache entries as a map.
Useful for:
- Debugging and inspection
- Bulk operations
- Cache migration
Expired entries should be excluded from the result.
Implementation
@override
Map<String, CacheEntry> getAll() {
// Filter out expired entries
final validEntries = <String, CacheEntry>{};
final expiredKeys = <String>[];
for (final entry in _cache.entries) {
if (entry.value.isExpired) {
expiredKeys.add(entry.key);
} else {
validEntries[entry.key] = entry.value;
}
}
// Clean up expired entries
expiredKeys.forEach(delete);
return Map.unmodifiable(validEntries);
}