我们是否需要使用ImagePicker Flutter插件手动删除录制的缓存视频文件?

发布于 2025-01-30 02:50:28 字数 643 浏览 4 评论 0 原文

我正在使用imagePicker( https://pub.dev/packages/image_picker )我注意到录制的视频存储在App的Cache文件夹中(示例:/Data/user/0/com.example.app/cache/999b6a18-114b-4fd3-b089-09ce4574bf76574bf765726572645726458033916036626262.Mp4

注意:使用摄像头挑选的图像和视频保存到您应用程序的本地缓存中,因此应仅暂时暂时存在。如果您需要永久存储您的选择图像,则有责任将其移至更永久的位置。

这是我想知道的:

  1. 文件夹中的文件将保留多长时间? (我担心积累了太多的视频文件)
  2. 缓存数据的机制是什么? Android/iOS系统是否对缓存文件夹的大小有一些限制?
  3. 如果存在某种限制,如果用户录制更多视频会发生什么,该系统会删除旧视频以腾出空间?

总体而言,你们建议我在处理后立即删除录制的缓存视频(例如将其上传到我的服务器)?

I am using the ImagePicker (https://pub.dev/packages/image_picker) plugin to record videos and I noticed the recorded videos are stored in app's cache folder (example: /data/user/0/com.example.app/cache/999b6a18-114b-4fd3-b089-09ce4574bf765726458033916036262.mp4")

In the plugin docs it says

Note: Images and videos picked using the camera are saved to your application's local cache, and should therefore be expected to only be around temporarily. If you require your picked image to be stored permanently, it is your responsibility to move it to a more permanent location.

Here's what I am wondering about:

  1. How long will the files remain in the cache folder? (I am concerned on too many video files being accumulated)
  2. What is the mechanism on the cache data? does the Android/IOs system has some limitations on the size of the cache folder?
  3. If there is some sort of limitations, what will happen if users record more videos will the system delete the older videos to make room?

Overall would you guys recommend that I delete the recorded cached video immediately after processing it (Example uploading it to my server)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瀞厅☆埖开 2025-02-06 02:50:28

这些文件将保留在缓存文件夹中多长时间?

通常,缓存的文件保留在文件夹中,直到您卸载应用程序或使用“清除缓存”选项(还可以与“文件清洁器”应用程序一起使用)。对于从Web API获取的图像,它们可能包含a 缓存控制标题将有助于定义指令以使其从缓存中无效。

有时候,根据软件覆盖的不同,在Android手机上可能会发生不同的行为,例如荣誉软件(EMUI)以不时清除缓存文件而闻名,但似乎并不是确切的在任何地方都提到了持续时间。

Android/iOS系统是否对缓存文件夹的大小有一些限制?

缓存文件夹没有尺寸限制,它将根据需要增长(或直到您的手机都用尽可用空间),这就是为什么人们倾向于建议当它变得太大时手动清除某些应用程序的缓存。

How long will the files remain in the cache folder?

Usually, cached files remains in the folder until you uninstall the application or when you use a "Clear Cache" option (also works with "File Cleaner" applications). In the case of images fetched from a web API they might contains a Cache-Control header which will help to define directives to invalidate them from the cache.

clear cache

Sometimes, a different behavior can occur on Android phones depending of the software overlay, for example Honor software (EMUI) is known for clearing cached files by itself from time to time, but it does not seem like the exact duration is mentioned anywhere.

Does the Android/iOS system has some limitations on the size of the cache folder?

The cache folder does not have a size limitation, it will grow as big as needed (or until your phone runs out of available space), this is why people tends to recommend clearing the cache of certain applications manually when it becomes too big.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文