Class ThreadLocalScopeCache
- java.lang.Object
-
- org.springframework.cloud.context.scope.thread.ThreadLocalScopeCache
-
- All Implemented Interfaces:
ScopeCache
public class ThreadLocalScopeCache extends Object implements ScopeCache
- Author:
- Dave Syer
-
-
Constructor Summary
Constructors Constructor Description ThreadLocalScopeCache()
-
Method Summary
All Methods Instance Methods Concrete 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
public Object remove(String name)
Description copied from interface:ScopeCacheRemoves the object with this name from the cache.- Specified by:
removein interfaceScopeCache- Parameters:
name- The object name.- Returns:
- The object removed, or null if there was none.
-
clear
public Collection<Object> clear()
Description copied from interface:ScopeCacheClears the cache and returns all objects in an unmodifiable collection.- Specified by:
clearin interfaceScopeCache- Returns:
- All objects stored in the cache.
-
get
public Object get(String name)
Description copied from interface:ScopeCacheGets the named object from the cache.- Specified by:
getin interfaceScopeCache- Parameters:
name- The name of the object.- Returns:
- The object with that name, or null if there is none.
-
put
public Object put(String name, Object value)
Description copied from interface:ScopeCachePut 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.- Specified by:
putin interfaceScopeCache- Parameters:
name- The key.value- The new candidate value.- Returns:
- The value that is in the cache at the end of the operation.
-
-