Baseflow / Baseflow/flutter_cached_network_image
Cache not deleted after stalePeriod is passed
- Dominant language
- Dart
- Stars
- 2.6k
- Forks
- 731
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 1
Description
## 🐛 Bug Report
I am implementing a CustomCachemanager with a `stalePeriod` of 1 minute to check if the cached data are deleted after the stale period passes. So far, it doesn't work and I don't know why. Any suggestion is welcome.
### Expected behavior
The cached data are deleted after 1 minute.
### Reproduction steps
1. Created a CustomCacheManager
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
```
class CustomCacheManager extends CacheManager with ImageCacheManager {
factory CustomCacheManager() {
return _instance;
}
CustomCacheManager._()
: super(Config(key, stalePeriod: const Duration(minutes: 1)));
static const key = 'libCachedImageData';
static final CustomCacheManager _instance = CustomCacheManager._();
}
```
2. Passed it in the CachedNetworkImage Constructor.
```
CachedNetworkImage(
imageUrl: imageUrl,
fit: BoxFit.cover,
cacheManager: CustomCacheManager(),
);
```
3. Ran the app, the image is loaded from the network as it should.
4. Terminate the app.
5. re-ran the app and the image is loaded from the cache as it should
6. Terminate the app and wait for some time (i.e.: 10 mins)
7. Launch the app. At this point, I expect the image to be fetched from the network again since the cache should be deleted. Instead, the image is still fetched from the cache.
I used the flag `CachedNetworkImage.logLevel = CacheManagerLogLevel.verbose;`
Am I missing something here?
### Configuration
**Version:** 3.3.1
**Platform:**
- Android 14
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.