Interface ScopeCache
-
- All Known Implementing Classes:
StandardScopeCache,ThreadLocalScopeCache
public interface ScopeCacheA special-purpose cache interface specifically for theGenericScopeto use to manage cached bean instances. Implementations generally fall into two categories: those that store values "globally" (i.e. one instance per key), and those that store potentially multiple instances per key based on context (e.g. via a thread local). All implementations should be thread safe.- Author:
- Dave Syer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Collection<Object>clear()Clears the cache and returns all objects in an unmodifiable collection.Objectget(String name)Gets the named object from the cache.Objectput(String name, Object value)Put a value in the cache if the key is not already used.Objectremove(String name)Removes the object with this name from the cache.
-
-
-
Method Detail
-
remove
Object remove(String name)
Removes the object with this name from the cache.- Parameters:
name- The object name.- Returns:
- The object removed, or null if there was none.
-
clear
Collection<Object> clear()
Clears the cache and returns all objects in an unmodifiable collection.- Returns:
- All objects stored in the cache.
-
get
Object get(String name)
Gets the named object from the cache.- Parameters:
name- The name of the object.- Returns:
- The object with that name, or null if there is none.
-
put
Object put(String name, Object value)
Put a value in the cache if the key is not already used. If one is already present with the name provided, it is not replaced, but is returned to the caller.- Parameters:
name- The key.value- The new candidate value.- Returns:
- The value that is in the cache at the end of the operation.
-
-