| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEBUG |
static java.lang.String |
LOG_TAG |
| Constructor and Description |
|---|
SimpleDiskLruCache(java.io.File directory,
int appVersion,
long capacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
abortEdit(CacheEntry cacheEntry)
abort edit
|
void |
abortEdit(java.lang.String key)
abort edit by key
|
CacheEntry |
beginEdit(java.lang.String key)
begin edit an
|
void |
clear()
clear all the content
|
void |
close()
Closes this cache.
|
void |
commitEdit(CacheEntry cacheEntry)
abort edit by key
|
boolean |
delete(java.lang.String key)
Drops the entry for
key if it exists and can be removed. |
void |
flush()
Force buffered operations to the filesystem.
|
long |
getCapacity() |
java.io.File |
getDirectory()
Returns the directory where this cache stores its data.
|
CacheEntry |
getEntry(java.lang.String key)
Returns a
CacheEntry named key, or null if it doesn't
exist is not currently readable. |
long |
getSize()
Returns the number of bytes currently being used to store the values in
this cache.
|
boolean |
has(java.lang.String key)
Check if has this key
|
void |
open()
open disk cache
|
java.lang.String |
toString() |
public static final java.lang.String LOG_TAG
public static boolean DEBUG
public SimpleDiskLruCache(java.io.File directory,
int appVersion,
long capacity)
directory - appVersion - capacity - public void clear()
throws java.io.IOException
public boolean has(java.lang.String key)
DiskCachepublic void open()
throws java.io.IOException
DiskCachepublic CacheEntry getEntry(java.lang.String key) throws java.io.IOException
CacheEntry named key, or null if it doesn't
exist is not currently readable. If a value is returned, it is moved to
the head of the LRU queue.public CacheEntry beginEdit(java.lang.String key) throws java.io.IOException
DiskCachepublic void abortEdit(CacheEntry cacheEntry)
DiskCachepublic void abortEdit(java.lang.String key)
DiskCachepublic void commitEdit(CacheEntry cacheEntry) throws java.io.IOException
DiskCachecommitEdit in interface DiskCachejava.io.IOExceptionpublic boolean delete(java.lang.String key)
throws java.io.IOException
key if it exists and can be removed. Entries
actively being edited cannot be removed.public long getCapacity()
getCapacity in interface DiskCachepublic long getSize()
public java.io.File getDirectory()
getDirectory in interface DiskCachepublic void flush()
throws java.io.IOException
public void close()
throws java.io.IOException
public java.lang.String toString()
toString in class java.lang.Object