Package helma.objectmodel
Interface ObjectCache
- All Known Implementing Classes:
CacheMap
,WeakCacheMap
public interface ObjectCache
Interface Helma object cache classes need to implement.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
clear()
Removes all items currently stored in the cache.boolean
containsKey
(Object key) Returns true if the collection contains an element for the key.int
containsKeys
(Object[] keys) Returns the number of keys in object arraykeys
that were not found in the Map.Gets the object associated with the specified key in the hashtable.Object[]
Return an array with all objects currently contained in the cache.Returns a map of statistics about the cachevoid
init
(Application app) Set theApplication
instance for the cache.Puts the specified element into the hashtable, using the specified key.Removes the element corresponding to the key.void
shutdown()
Called when the application holding the cache is stopped.int
size()
Return the number of objects currently stored in the cache.void
updateProperties
(Properties props) Called when the application's properties have been updated to let the cache implementation update its settings.
-
Method Details
-
init
Set theApplication
instance for the cache.- Parameters:
app
- the app instance
-
shutdown
void shutdown()Called when the application holding the cache is stopped. -
updateProperties
Called when the application's properties have been updated to let the cache implementation update its settings.- Parameters:
props
-
-
containsKey
Returns true if the collection contains an element for the key.- Parameters:
key
- the key that we are looking for
-
containsKeys
Returns the number of keys in object arraykeys
that were not found in the Map. Those keys that are contained in the Map are nulled out in the array.- Parameters:
keys
- an array of key objects we are looking for- See Also:
-
get
Gets the object associated with the specified key in the hashtable.- Parameters:
key
- the specified key- Returns:
- the element for the key or null if the key is not defined in the hash table.
- See Also:
-
put
Puts the specified element into the hashtable, using the specified key. The element may be retrieved by doing a get() with the same key. The key and the element cannot be null.- Parameters:
key
- the specified key in the hashtablevalue
- the specified element- Returns:
- the old value of the key, or null if it did not have one.
- Throws:
NullPointerException
- If the value of the element is equal to null.- See Also:
-
remove
Removes the element corresponding to the key. Does nothing if the key is not present.- Parameters:
key
- the key that needs to be removed- Returns:
- the value of key, or null if the key was not found.
-
clear
boolean clear()Removes all items currently stored in the cache.- Returns:
- true if the operation succeeded
-
size
int size()Return the number of objects currently stored in the cache.- Returns:
- the number of cached items
-
getCachedObjects
Object[] getCachedObjects()Return an array with all objects currently contained in the cache. -
getStatistics
Returns a map of statistics about the cache
-