Files
social-app/apps/lib/data/cache/memory_cache_store.dart
T

25 lines
472 B
Dart
Raw Normal View History

import 'cache_store.dart';
class MemoryCacheStore implements CacheStore {
final Map<String, Object?> _values = <String, Object?>{};
@override
Future<T?> read<T>(String key) async {
final value = _values[key];
if (value is T) {
return value;
}
return null;
}
@override
Future<void> write<T>(String key, T value) async {
_values[key] = value;
}
@override
Future<void> remove(String key) async {
_values.remove(key);
}
}