Android应用程序的缓存
应用程序的缓存目录中存储哪些数据?我没有在我的应用程序中使用它,但我仍然可以看到它的大小在增长。是webview缓存图片吗? HttpClient 存储一些数据?还有什么?
我可以随时从代码中安全地删除其内容吗?
提前致谢
What data is stored in application's cache directory? I'm not using it in my application and I still can see its size grows. Is it webview caching images? HttpClient storing some data? What else?
Can I erase it's contents safely from code at any time?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Android 可以在空间不足时清理缓存,因此对于任何使用缓存文件的应用程序的假设应该是它们可以随时删除。换句话说,如果您正在使用一些其他模块在应用程序中创建缓存,那么假设这些模块编码良好,您应该能够随时安全地删除这些文件。它会对性能产生什么影响,这取决于更多因素。
也许只是控制大小,所以当您觉得旧文件变得太大时删除旧文件?我认为Android建议缓存为1MB。
Android can clean the cache up whenever it's running low on space, so the assumption for whatever application using cache files should be that they can be deleted at any time. In other words, if you're using some other modules that create the cache in your application, you should be able to delete those files safely at any time, assuming those modules are well coded. What it will do to performance, that depends on many more things.
Maybe just keep the size under control, so delete the older files when you feel it gets too big? I think Android recommends 1MB for cache.