stash 3.2.0 copy "stash: ^3.2.0" to clipboard
stash: ^3.2.0 copied to clipboard

outdated

Standard caching API for Dart. Defines a common mechanism to create, access, update, and remove information from caches. Provides a in memory reference implementation

example/example.md

import 'package:stash_memory/stash_memory.dart';

class Task {
  final int id;
  final String title;
  final bool completed;

  Task(this.id, this.title, {this.completed = false});

  @override
  String toString() {
    return 'Task $id: "$title" is ${completed ? "completed" : "not completed"}';
  }
}

void main() async {
  // Creates a memory based cache with a a capacity of 10
  final cache = newMemoryCache(maxEntries: 10);

  // Adds a task with key 'task1' to the cache
  await cache.put(
      'task1', Task(1, 'Run stash_memory example', completed: true));
  // Retrieves the value from the cache
  final value = await cache.get('task1');

  print(value);
}
136
likes
0
pub points
87%
popularity

Publisher

verified publisherivoleitao.dev

Standard caching API for Dart. Defines a common mechanism to create, access, update, and remove information from caches. Provides a in memory reference implementation

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

async, clock, equatable, uuid

More

Packages that depend on stash