ente/lib/core/image_cache.dart

17 lines
376 B
Dart
Raw Normal View History

2020-04-24 20:59:11 +00:00
import 'dart:typed_data';
import 'package:photos/core/lru_map.dart';
2020-05-01 18:20:12 +00:00
import 'package:photos/models/photo.dart';
2020-04-24 20:59:11 +00:00
class ImageLruCache {
static LRUMap<int, Uint8List> _map = LRUMap(500);
static Uint8List get(Photo photo) {
return _map.get(photo.generatedId);
}
static void put(Photo photo, Uint8List imageData) {
_map.put(photo.generatedId, imageData);
}
}