caching - Android: How to access/manage cached files after an app restart? -


looking @ docs when comes caching, seems i'm supposed use createtempfile(), if call succeeds, creates empty file. , if called again same arguments, won't return same filename.

  1. so if restart app, not have way retrieve temporary file?

  2. if wanted implement lru algorithm removing files cache, creating normal (non-temporary) file key value pairs of filenames , timestamps seem reasonable? (since don't think android updates sort last accessed times files)

i'd manage cached files in memory alone. create separate directory cache files , use in memory lru singleton class managing files. each time app restarted, scan cache directory , reload lru cache directory contents. loose cache statistics on restart, if that's bad thing can handled when paused.

managing cache in memory faster writing , re-writing key-value pair file.

how many files intend keep in cache?


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -