image_cache.dart 359 B

12345678910111213141516
  1. import 'dart:io';
  2. import 'package:photos/core/cache/lru_map.dart';
  3. import 'package:photos/models/photo.dart';
  4. class ImageLruCache {
  5. static LRUMap<int, File> _map = LRUMap(500);
  6. static File get(Photo photo) {
  7. return _map.get(photo.generatedId);
  8. }
  9. static void put(Photo photo, File imageData) {
  10. _map.put(photo.generatedId, imageData);
  11. }
  12. }