Cache does not respect stalePeriod on web

Đang mở
#393 0 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
58/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
dart, flutter
Lĩnh vực
web-dev

Hướng nghiên cứu

Bắt đầu với lib/src/config/_config_web.dart và kiểm tra cách storage provider được chọn. Sau đó đọc lib/src/storage/cache_info_repositories/non_storing_object_provider.dart và lib/src/cache_store.dart, tập trung vào getOldObjects và cách xử lý stalePeriod. Tái hiện kịch bản web một phút và xác nhận rằng một mục đã hết hạn được xóa để request tiếp theo đến được network.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

🐛 Bug Report

When setting a custom stalePeriod on web, the cache remains valid and the browser will access data via the cache rather than sending out a fresh network request, even when the Duration specified in stalePeriod has expired.

Expected behaviour

On all platforms, after a custom stalePeriod is set, items should be removed from the cache after the specified Duration has expired.

Reproduction steps
  1. Extend CacheManager with a Config(...stalePeriod: Duration(minutes: 1)
  2. Make a request that uses the CacheManager
  3. Wait over one minute
  4. Make the same request again

Observe that the second request hits the cache, not the web.

Configuration

Version: 3.3.0

Platform:

  • [✓] 🌏 Web
Cause

By default, the config for web uses the NonStoringObjectProvider. Old cache objects are removed using their provider's getOldObjects method. The implementation of this in the NonStoringObjectProvider never does anything.

Ideally, the web config should be update to use a repo that has a working implementation of getOldObjects.

Ngôn ngữ chính
Dart
Star
814
Fork
513
Merge trung bình
7 giờ 34 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Baseflow/flutter_cache_manager

Tất cả issue của Baseflow/flutter_cache_manager

Issue tương tự

Thêm issue về Dart

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.