com.android.volley
Interface Cache

All Known Implementing Classes:
DiskBasedCache, NoCache

public interface Cache

An interface for a cache keyed by a String with a byte array as data.


Nested Class Summary
static class Cache.Entry
          Data and metadata for an entry returned by the cache.
 
Method Summary
 void clear()
          Empties the cache.
 Cache.Entry get(String key)
          Retrieves an entry from the cache.
 void initialize()
          Performs any potentially long-running actions needed to initialize the cache; will be called from a worker thread.
 void invalidate(String key, boolean fullExpire)
          Invalidates an entry in the cache.
 void put(String key, Cache.Entry entry)
          Adds or replaces an entry to the cache.
 void remove(String key)
          Removes an entry from the cache.
 

Method Detail

get

Cache.Entry get(String key)
Retrieves an entry from the cache.

Parameters:
key - Cache key
Returns:
An Cache.Entry or null in the event of a cache miss

put

void put(String key,
         Cache.Entry entry)
Adds or replaces an entry to the cache.

Parameters:
key - Cache key
entry - Data to store and metadata for cache coherency, TTL, etc.

initialize

void initialize()
Performs any potentially long-running actions needed to initialize the cache; will be called from a worker thread.


invalidate

void invalidate(String key,
                boolean fullExpire)
Invalidates an entry in the cache.

Parameters:
key - Cache key
fullExpire - True to fully expire the entry, false to soft expire

remove

void remove(String key)
Removes an entry from the cache.

Parameters:
key - Cache key

clear

void clear()
Empties the cache.