Cache does not respect stalePeriod on web

Aperta
#393 0 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
58/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
dart, flutter
Ambito
web-dev

Direzione di ricerca

Inizia con lib/src/config/_config_web.dart e analizza come viene selezionato il provider di storage. Poi leggi lib/src/storage/cache_info_repositories/non_storing_object_provider.dart e lib/src/cache_store.dart, concentrandoti su getOldObjects e sulla gestione di stalePeriod. Riproduci lo scenario web di un minuto e conferma che un elemento scaduto venga rimosso, in modo che la richiesta successiva raggiunga la rete.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

🐛 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.

Lingua principale
Dart
Stelle
814
Fork
513
Merge medio
7h 34m
PR unite (30g)
2

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Baseflow/flutter_cache_manager

Tutte le issue di Baseflow/flutter_cache_manager

Issue simili

Altre issue su Dart

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.