Interface ScopeCache
- All Known Implementing Classes:
StandardScopeCache, ThreadLocalScopeCache
public interface ScopeCache
A special-purpose cache interface specifically for the
GenericScope to 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
Modifier and TypeMethodDescriptionclear()Clears the cache and returns all objects in an unmodifiable collection.Gets the named object from the cache.Put a value in the cache if the key is not already used.Removes the object with this name from the cache.
-
Method Details
-
remove
-
clear
Collection<Object> clear()Clears the cache and returns all objects in an unmodifiable collection.- Returns:
- All objects stored in the cache.
-
get
-
put
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.
-