org.fusesource.restygwt.client.cache
Class DefaultQueueableCacheStorage

java.lang.Object
  extended by org.fusesource.restygwt.client.cache.DefaultQueueableCacheStorage
All Implemented Interfaces:
CacheStorage<Response>, QueueableCacheStorage
Direct Known Subclasses:
VolatileQueueableCacheStorage

public class DefaultQueueableCacheStorage
extends Object
implements QueueableCacheStorage

this implementation stores Response objects until they are removed or purged. when retrieved from the cache the Response will have an extra header field "X-Resty-Cache". this allows CallbackFilter to determine the action on whether the Response came from the cache or just came over the wire.

Author:
kristian

Field Summary
protected  Map<String,HashMap<CacheKey,Response>> cache
          key <> value hashmap for holding cache values.
 
Fields inherited from interface org.fusesource.restygwt.client.cache.QueueableCacheStorage
RESTY_CACHE_HEADER
 
Constructor Summary
DefaultQueueableCacheStorage()
           
 
Method Summary
 void addCallback(CacheKey k, RequestCallback rc)
           
 Response getResultOrReturnNull(CacheKey key)
           
 Response getResultOrReturnNull(CacheKey key, String scope)
           
 boolean hasCallback(CacheKey k)
           
 void purge()
          purge the complete cache
 void purge(String scope)
          purge a particular ident, e.g.
 void putResult(CacheKey key, Response response)
          default put method
 void putResult(CacheKey key, Response response, String... scopes)
          put by ident/scope.
protected  void putResult(CacheKey key, Response response, String scope)
           
 void remove(CacheKey key)
          default delete method
 void remove(CacheKey key, String... scopes)
          delete by ident/scope.
 List<RequestCallback> removeCallbacks(CacheKey k)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

protected final Map<String,HashMap<CacheKey,Response>> cache
key <> value hashmap for holding cache values. nothing special here. invalidated values will be dropped by timer

Constructor Detail

DefaultQueueableCacheStorage

public DefaultQueueableCacheStorage()
Method Detail

getResultOrReturnNull

public Response getResultOrReturnNull(CacheKey key)
Specified by:
getResultOrReturnNull in interface CacheStorage<Response>

getResultOrReturnNull

public Response getResultOrReturnNull(CacheKey key,
                                      String scope)
Specified by:
getResultOrReturnNull in interface CacheStorage<Response>

putResult

public void putResult(CacheKey key,
                      Response response)
Description copied from interface: CacheStorage
default put method

Specified by:
putResult in interface CacheStorage<Response>

putResult

protected void putResult(CacheKey key,
                         Response response,
                         String scope)

putResult

public void putResult(CacheKey key,
                      Response response,
                      String... scopes)
Description copied from interface: CacheStorage
put by ident/scope. e.g. to invalidate later on by domain class

Specified by:
putResult in interface CacheStorage<Response>

hasCallback

public boolean hasCallback(CacheKey k)
Specified by:
hasCallback in interface QueueableCacheStorage

addCallback

public void addCallback(CacheKey k,
                        RequestCallback rc)
Specified by:
addCallback in interface QueueableCacheStorage

removeCallbacks

public List<RequestCallback> removeCallbacks(CacheKey k)
Specified by:
removeCallbacks in interface QueueableCacheStorage

purge

public void purge()
Description copied from interface: CacheStorage
purge the complete cache

Specified by:
purge in interface CacheStorage<Response>

purge

public void purge(String scope)
Description copied from interface: CacheStorage
purge a particular ident, e.g. domain scope

Specified by:
purge in interface CacheStorage<Response>

remove

public void remove(CacheKey key)
Description copied from interface: CacheStorage
default delete method

Specified by:
remove in interface CacheStorage<Response>

remove

public void remove(CacheKey key,
                   String... scopes)
Description copied from interface: CacheStorage
delete by ident/scope. e.g. to invalidate later on by domain class

Specified by:
remove in interface CacheStorage<Response>


Copyright © 2010-2011 FuseSource, Corp.. All Rights Reserved.