Class MapCache

  • All Implemented Interfaces:
    Cache

    public class MapCache
    extends Object
    implements Cache
    Use any Map to implement the Cache. No cache eviction going on here. Just gives a Map a Cache interface.
    • Constructor Detail

      • MapCache

        public MapCache()
    • Method Detail

      • put

        public Object put​(Object key,
                          Object value)
        Description copied from interface: Cache
        Puts an object into the cache.
        Specified by:
        put in interface Cache
      • get

        public Object get​(Object key)
        Description copied from interface: Cache
        Gets an object that was previously put into this object.
        Specified by:
        get in interface Cache
        Returns:
        null if the object was not previously put or if the object has expired out of the cache.
      • remove

        public Object remove​(Object key)
        Description copied from interface: Cache
        Removes an object from the cache.
        Specified by:
        remove in interface Cache
        Returns:
        the object associated with the key if it was still in the cache.
      • close

        public void close()
        Description copied from interface: Cache
        Lets a cache know it will not be used any further and that it can release acquired resources
        Specified by:
        close in interface Cache
      • size

        public int size()
        Description copied from interface: Cache
        How big is the cache right now?
        Specified by:
        size in interface Cache
        Returns:
        the size.