org.apache.chemistry.opencmis.client.bindings.cache
Interface Cache

All Superinterfaces:
Serializable
All Known Implementing Classes:
CacheImpl

public interface Cache
extends Serializable

An interface for an hierarchical cache.

Each level of the hierarchy could use a different caching strategy. The cache is initialize by defining the classes that handle the caching for one level. These classes must implement the CacheLevel interface.

Level configuration string format: " <class name> [param1=value1,param2=value2,...]".
For example: org.apache.opencmis.client.bindings.cache.impl.MapCacheLevelImpl capacity=10

Author:
Florian Müller
See Also:
CacheLevel

Method Summary
 int check(String... keys)
          Checks if a given key is in the cache.
 Object get(String... keys)
          Retrieves an object from the cache.
 void initialize(String[] cacheLevelConfig)
          Initializes the cache.
 void put(Object value, String... keys)
          Adds an object to the cache.
 void remove(String... keys)
          Removes a branch or leaf from the cache.
 void writeLock()
          Applies a write lock.
 void writeUnlock()
          Releases a write lock.
 

Method Detail

initialize

void initialize(String[] cacheLevelConfig)
Initializes the cache.

Parameters:
cacheLevelConfig - the level configuration strings from the root to the leafs

put

void put(Object value,
         String... keys)
Adds an object to the cache.

Parameters:
value - the object
keys - the keys for this object

get

Object get(String... keys)
Retrieves an object from the cache.

Parameters:
keys - the keys
Returns:
the object or null if the branch or leaf doesn't exist

remove

void remove(String... keys)
Removes a branch or leaf from the cache.

Parameters:
keys - the keys of the branch or leaf

check

int check(String... keys)
Checks if a given key is in the cache.

Parameters:
keys - the keys of the branch or leaf
Returns:
the index of the first key part that is not in the cache or keys.length if the object is in the cache

writeLock

void writeLock()
Applies a write lock.


writeUnlock

void writeUnlock()
Releases a write lock.



Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.