سؤال

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