memory_cache 1.0.0 memory_cache: ^1.0.0 copied to clipboard
Memory Cache is simple, fast and global in-memory cache.
example/memory_cache_example.dart
import 'package:memory_cache/memory_cache.dart';
void main() {
MemoryCache.instance.create(
'myKey',
'myValue',
expiry: const Duration(seconds: 5),
);
String? myValue = MemoryCache.instance.read<String>('myKey');
print(myValue);
MemoryCache.instance.update('myKey', 'myUpdatedValue');
myValue = MemoryCache.instance.read<String>('myKey');
print(myValue);
MemoryCache.instance.delete('myKey');
myValue = MemoryCache.instance.read<String>('myKey');
print(myValue);
}