Class ThreadLocalScopeCache

  • All Implemented Interfaces:
    ScopeCache

    public class ThreadLocalScopeCache
    extends Object
    implements ScopeCache
    Author:
    Dave Syer
    • Constructor Detail

      • ThreadLocalScopeCache

        public ThreadLocalScopeCache()
    • Method Detail

      • remove

        public Object remove​(String name)
        Description copied from interface: ScopeCache
        Removes the object with this name from the cache.
        Specified by:
        remove in interface ScopeCache
        Parameters:
        name - The object name.
        Returns:
        The object removed, or null if there was none.
      • clear

        public Collection<Object> clear()
        Description copied from interface: ScopeCache
        Clears the cache and returns all objects in an unmodifiable collection.
        Specified by:
        clear in interface ScopeCache
        Returns:
        All objects stored in the cache.
      • get

        public Object get​(String name)
        Description copied from interface: ScopeCache
        Gets the named object from the cache.
        Specified by:
        get in interface ScopeCache
        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: ScopeCache
        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.
        Specified by:
        put in interface ScopeCache
        Parameters:
        name - The key.
        value - The new candidate value.
        Returns:
        The value that is in the cache at the end of the operation.