org.alfresco.repo.cache
Interface SimpleCache

All Known Implementing Classes:
MemoryCache

public interface SimpleCache

Basic caching interface.

All implementations must be thread-safe. Additionally, the use of the Serializable for both keys and values ensures that the underlying cache implementations can support both clustered caches as well as persistent caches.

All implementations must support null values. It therefore follows that

    (simpleCache.contains(key) == true) does not imply (simpleCache.get(key) != null)
 
but
    (simpleCache.contains(key) == false) implies (simpleCache.get(key) == null)
 


Method Summary
 void clear()
           
 boolean contains(java.io.Serializable key)
           
 java.lang.Object get(java.io.Serializable key)
           
 java.util.Collection getKeys()
           
 void put(java.io.Serializable key, java.lang.Object value)
           
 void remove(java.io.Serializable key)
          Removes the cache entry whether or not the value stored against it is null.
 

Method Detail

contains

boolean contains(java.io.Serializable key)
Parameters:
key - the cache key to check up on
Returns:
Returns true if there is a cache entry, regardless of whether the value itself is null

getKeys

java.util.Collection getKeys()

get

java.lang.Object get(java.io.Serializable key)
Parameters:
key -
Returns:
Returns the value associated with the key. It will be null if the value is null or if the cache doesn't have an entry.

put

void put(java.io.Serializable key,
         java.lang.Object value)
Parameters:
key - the key against which to store the value
value - the value to store. null is allowed.

remove

void remove(java.io.Serializable key)
Removes the cache entry whether or not the value stored against it is null.

Parameters:
key - the key value to remove

clear

void clear()


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.