com.duowan.mobile.netroid.cache
Class DiskCache.Entry

java.lang.Object
  extended by com.duowan.mobile.netroid.cache.DiskCache.Entry
Enclosing class:
DiskCache

public static class DiskCache.Entry
extends java.lang.Object

Data and metadata for an entry returned by the cache.


Field Summary
 java.lang.String charset
          Charset for cache entry, retrieve by the http header.
 byte[] data
          The data returned from cache.
 long expireTime
          Expire time for cache entry.
 
Constructor Summary
DiskCache.Entry()
           
DiskCache.Entry(byte[] data, java.lang.String charset)
           
 
Method Summary
 int getSize()
          Get the cache data size in byte.
static boolean invalidate(DiskCache.Entry entry, long expireTime)
          Invalidate cache entry by the expireTime.
 boolean isExpired()
          True if the entry is expired.
 boolean refreshNeeded()
          True if a refresh is needed from the original data source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

public byte[] data
The data returned from cache.


expireTime

public long expireTime
Expire time for cache entry.


charset

public java.lang.String charset
Charset for cache entry, retrieve by the http header.

Constructor Detail

DiskCache.Entry

public DiskCache.Entry()

DiskCache.Entry

public DiskCache.Entry(byte[] data,
                       java.lang.String charset)
Method Detail

isExpired

public boolean isExpired()
True if the entry is expired.


refreshNeeded

public boolean refreshNeeded()
True if a refresh is needed from the original data source.


getSize

public int getSize()
Get the cache data size in byte.


invalidate

public static boolean invalidate(DiskCache.Entry entry,
                                 long expireTime)
Invalidate cache entry by the expireTime.