当前位置: 首页 > 工具软件 > DiskLruCache > 使用案例 >

DiskLruCache

闻法
2023-12-01
Key Elements:
1. DisLruCache
     a. Created by static method DisLruCache.open()
     b. Need to close when you finished write in one piece of cache
     c. If you want to calculate the size of all the cache, call DisLruCache.size()
     d. If you want to delte one cache: call DisLruCache.remove(key)
     e. If you want to delete all the caches, call DisLruCache.delete()
2. Editor
     a. Created by disLruCache.edit(key)
     b. Use commit() if you are sure to write it into cache.
     c. Use abort() if you give up the cache
3. OutputStream
     a. When you write something to cache, you need to get a outputstream, which is got by editor.newOutputStream()
4. Snap
     a. when you read from cache, you first need to get a snap from editor by calling:editor.get(key)
5. InputStream
     a. the input stream is actually where you finally get the cache contents from, which can be got by calling:snapShot.getInputStream(0)

Journal file:
There are several key words:
1. DIRTY: means a record that is not committed
2. CLEAN: means a record has been committed
3. READ: means a record has been read
 类似资料:

相关阅读

相关文章

相关问答