org.shiftone.cache.adaptor
Class CacheMap

java.lang.Object
  extended byorg.shiftone.cache.adaptor.CacheMap
All Implemented Interfaces:
java.util.Map

public class CacheMap
extends java.lang.Object
implements java.util.Map

Makes a shiftone cache look like a map.

Version:
$Revision: 1.3 $
Author:
Jeff Drost

Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Constructor Summary
CacheMap(Cache cache)
           
 
Method Summary
 void clear()
          Clears the cache
 boolean containsKey(java.lang.Object key)
          Warning - just because this method returns true, you can NOT expect to be able to get the value of the object that the cache contains.
 boolean containsValue(java.lang.Object value)
          not implemented
 java.util.Set entrySet()
          not implemented
 java.lang.Object get(java.lang.Object key)
          Gets an object from the cache based on it's key
 boolean isEmpty()
          Is the cache empty at this instance in time
 java.util.Set keySet()
          not implemented
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Puts an object into the cache and returns the previous value that was associated with that key.
 void putAll(java.util.Map map)
          Copies all of the mappings from the specified map to this cache.
 java.lang.Object remove(java.lang.Object key)
           
 int size()
          The size of this cache at this instance in time
 java.util.Collection values()
          not implemented
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

CacheMap

public CacheMap(Cache cache)
Method Detail

size

public int size()
The size of this cache at this instance in time

Specified by:
size in interface java.util.Map

isEmpty

public boolean isEmpty()
Is the cache empty at this instance in time

Specified by:
isEmpty in interface java.util.Map

containsKey

public boolean containsKey(java.lang.Object key)
Warning - just because this method returns true, you can NOT expect to be able to get the value of the object that the cache contains. This is because some time will pass between when you test for the elements existance in the cache, and when you call get(). During that window of time, the cache element may be evicted.

Specified by:
containsKey in interface java.util.Map

get

public java.lang.Object get(java.lang.Object key)
Gets an object from the cache based on it's key

Specified by:
get in interface java.util.Map

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Puts an object into the cache and returns the previous value that was associated with that key.

Specified by:
put in interface java.util.Map

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map

putAll

public void putAll(java.util.Map map)
Copies all of the mappings from the specified map to this cache.

Specified by:
putAll in interface java.util.Map

clear

public void clear()
Clears the cache

Specified by:
clear in interface java.util.Map

containsValue

public boolean containsValue(java.lang.Object value)
not implemented

Specified by:
containsValue in interface java.util.Map

keySet

public java.util.Set keySet()
not implemented

Specified by:
keySet in interface java.util.Map

values

public java.util.Collection values()
not implemented

Specified by:
values in interface java.util.Map

entrySet

public java.util.Set entrySet()
not implemented

Specified by:
entrySet in interface java.util.Map