https://github.com/gokberkbar/memory_cache
Memory Cache is simple, fast and global in-memory cache with CRUD features.
https://github.com/gokberkbar/memory_cache
cache dart flutter pubdev
Last synced: 8 months ago
JSON representation
Memory Cache is simple, fast and global in-memory cache with CRUD features.
- Host: GitHub
- URL: https://github.com/gokberkbar/memory_cache
- Owner: gokberkbar
- License: mit
- Created: 2022-08-08T13:49:56.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-31T12:53:53.000Z (about 3 years ago)
- Last Synced: 2025-06-14T18:07:37.807Z (8 months ago)
- Topics: cache, dart, flutter, pubdev
- Language: Dart
- Homepage: https://pub.dev/packages/memory_cache
- Size: 7.81 KB
- Stars: 20
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Memory Cache
Memory Cache is simple, fast and global in-memory cache.
## Features
- Create, read, update, delete and invalidate cache.
- Expirable Cache
- Creating local MemoryCache instance.
## Getting started
### Use this package as a Library
---
Depend On it
Run this command
with Dart:
```
$ dart pub add memory_cache
```
with Flutter:
```
$ flutter pub add memory_cache
```
This will add a line like this to your package's pubspec.yaml (and run an implicit `dart pub get` or `flutter pub get`):
```
dependencies:
memory_cache: ^1.2.0
```
## Usage
### Create New Value
```dart
MemoryCache.instance.create('myKey', 'myValue');
```
with Expiry:
```dart
MemoryCache.instance.create(
'myKey',
'myValue',
expiry: const Duration(seconds: 5),
);
```
### Read Value
```dart
final myValue = MemoryCache.instance.read('myKey');
```
### Update Value
```dart
MemoryCache.instance.update('myKey', 'myUpdatedValue');
```
### Delete Value
```dart
MemoryCache.instance.delete('myKey');
```
### Local Instance
MemoryCache can be created locally and same features will be supported
```dart
final MemoryCache localCache = MemoryCache();
```