GWTP Dispatch client 0.7-redhat-1

com.gwtplatform.dispatch.client.actionhandler.caching
Class DefaultCacheImpl

java.lang.Object
  extended by com.gwtplatform.dispatch.client.actionhandler.caching.DefaultCacheImpl
All Implemented Interfaces:
Cache

public class DefaultCacheImpl
extends Object
implements Cache

Default Implementation for Cache.

Author:
Sunny Gupta

Constructor Summary
DefaultCacheImpl()
          Initializes the cache with auto expiration OFF.
DefaultCacheImpl(long autoExpireTimeInMs)
          Initialize the cache with auto expiration ON.
 
Method Summary
 void clear()
          Clears the entire cache.
 Object get(Object key)
          Returns the cached value corresponding to key.
 long getAutoExpireTimeInMs()
           
 long getLastUpateTime(Object key)
          Returns the last update time in milliseconds since January 1, 1970, 00:00:00 GMT for the cached entry.
 void put(Object key, Object value)
          Puts the key-value pair in the cache.
 void remove(Object key)
          Removes the entry from the cache.
 void setAutoExpireTimeInMs(long autoExpireTimeInMs)
          Set the auto expiry time, after which an entry will expire after it is put in cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCacheImpl

public DefaultCacheImpl()
Initializes the cache with auto expiration OFF.


DefaultCacheImpl

public DefaultCacheImpl(long autoExpireTimeInMs)
Initialize the cache with auto expiration ON.

Parameters:
autoExpireTimeInMs - Time in milliseconds after which entries in cache expire
Method Detail

clear

public void clear()
Description copied from interface: Cache
Clears the entire cache.

Specified by:
clear in interface Cache

get

public Object get(Object key)
Description copied from interface: Cache
Returns the cached value corresponding to key.

Specified by:
get in interface Cache
Parameters:
key - The key for the cached entry
Returns:
The value corresponding to key

put

public void put(Object key,
                Object value)
Description copied from interface: Cache
Puts the key-value pair in the cache. If an entry with key already exists, it is overwritten. If automatic expiration is used, this entry will be expired after Cache.getAutoExpireTimeInMs() milliseconds.

Specified by:
put in interface Cache
Parameters:
key - The key for the entry to be cached
value - The corresponding value

remove

public void remove(Object key)
Description copied from interface: Cache
Removes the entry from the cache.

Specified by:
remove in interface Cache
Parameters:
key - The key for the cached entry

getLastUpateTime

public long getLastUpateTime(Object key)
Description copied from interface: Cache
Returns the last update time in milliseconds since January 1, 1970, 00:00:00 GMT for the cached entry.

Specified by:
getLastUpateTime in interface Cache
Parameters:
key - The key for which last update time is required
Returns:
The last update time as long value, if the value is cached, otherwise -1

getAutoExpireTimeInMs

public long getAutoExpireTimeInMs()
Specified by:
getAutoExpireTimeInMs in interface Cache

setAutoExpireTimeInMs

public void setAutoExpireTimeInMs(long autoExpireTimeInMs)
Description copied from interface: Cache
Set the auto expiry time, after which an entry will expire after it is put in cache.

Specified by:
setAutoExpireTimeInMs in interface Cache
Parameters:
autoExpireTimeInMs - The auto expiry time in milliseconds

GWTP Dispatch client 0.7-redhat-1

Copyright © 2010-2013 JBoss by Red Hat. All Rights Reserved.