Skip to main content

flutter_lru_cache 1.0.4 copy "flutter_lru_cache: ^1.0.4" to clipboard
flutter_lru_cache: ^1.0.4 copied to clipboard

A simple and efficient LRU (Least Recently Used) cache implementation for Dart and Flutter, providing O(1) read and write operations based on LinkedHashMap.

example/flutter_lru_cache_example.dart

import 'package:flutter_lru_cache/lru_cache.dart';

void main() {
  final lruCache = LRUCache<int, String>(3);

  lruCache[1] = "A";
  lruCache[2] = "B";
  lruCache[3] = "C";
  print(lruCache);

  print(lruCache[1]); // 访问key=1,将其移动到最近使用的位置
  lruCache[4] = "D"; // 添加新的元素,触发移除最久未使用的元素
  print(lruCache);
}
1
likes
155
points
168
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A simple and efficient LRU (Least Recently Used) cache implementation for Dart and Flutter, providing O(1) read and write operations based on LinkedHashMap.

Repository (GitHub)
View/report issues

Topics

#cache #lru

License

MIT (license)

More

Packages that depend on flutter_lru_cache