I have a simple question: if I use URLConnection.setUseCaches(true) when loading something from web, when will those cached files expire? I'm developing for android, but it hardly makes any difference... So when will cache files be removed from SD card?

有帮助吗?

解决方案

This question's answer suggests that URLConnection.setUseCaches(true) has no effect.

What Neil then describes is how Android apps stored internally (phone memory) can also have cached content, held in /data/data/packagename/cache. To answer your original question but applied to this feature, the system is ultimately in control of these areas, although you are supposed to look after your own content, as described in the API.

其他提示

If the UseCaches flag on a connection is true, the connection is allowed to use whatever caches it can. If false, caches are to be ignored. The default value comes from DefaultUseCaches, which defaults to true.**So,to use a cache you need to implement one on your own..Setting UseCaches flag to true jus lets you use the available cache.. but doesn't implement any cache on its own..

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top