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.
so if restart app, not have way retrieve temporary file?
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
Post a Comment