How can i store same file from other sources? And what mechanism of storing and naming files in cache?

huangapple go评论54阅读模式
英文:

How can i store same file from other sources? And what mechanism of storing and naming files in cache?

问题

我正在使用CachedNetworkImage(https://pub.dev/packages/flutter_cache_manager)。

我的应用程序从三个来源加载并缓存图像(它们是相同的,取决于连接速度和可用性)。这些图像是唯一的。

理想情况下,我只想通过文件名(它只是一个数字)放入/从缓存中获取。

英文:

I using CachedNetworkImage (https://pub.dev/packages/flutter_cache_manager)

My application load and cache image from three sources (they are equal, Depending on the speed connection and availabality). the images are unique.

Ideally i want to put in/get from cache only by filename (it is just a number).

答案1

得分: 1

你可以使用 flutter_cache_manager 包中的 CachedNetworkImage widget 从网络源加载和缓存图像,使用图像 URL 作为缓存的键。但是,如果你想要使用自定义键来进行缓存,你可以使用同一包中的 DefaultCacheManager 类来创建一个自定义缓存管理器,该管理器使用自定义键。

英文:

You can use the CachedNetworkImage widget from the flutter_cache_manager package to load and cache images from a network source, using the image URL as a key for caching. However, if you want to use a custom key for caching, you can use the DefaultCacheManager class from the same package to create a custom cache manager that uses a custom key.

huangapple
  • 本文由 发表于 2023年6月29日 17:20:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/76579735.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定