memory_cache 1.2.0 copy "memory_cache: ^1.2.0" to clipboard
memory_cache: ^1.2.0 copied to clipboard

Memory Cache is simple, fast and global in-memory cache with CRUD features.

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);

  final MemoryCache localCache = MemoryCache();
  localCache.create(
    'myKey',
    'myValue',
    expiry: const Duration(seconds: 5),
  );
  String? localCacheValue = localCache.read<String>('myKey');
  print(localCacheValue);
  print(MemoryCache.instance.read<String>('myKey'));
}
32
likes
140
pub points
89%
popularity

Publisher

verified publishergokberk.dev

Memory Cache is simple, fast and global in-memory cache with CRUD features.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on memory_cache