Module openj9.dtfj

Class ObjectLruCache

  • All Implemented Interfaces:
    Serializable

    public final class ObjectLruCache
    extends AbstractLruCache
    This class provides an LRU (Least Recently Used) cache which maps integer keys to object values. See the description in the superclass AbstractLruCache for more details.
    See Also:
    Serialized Form
    • Constructor Detail

      • ObjectLruCache

        public ObjectLruCache​(int maxSize)
        Create a new ObjectLruCache.
        Parameters:
        maxSize - the maximum size the cache can grow to
    • Method Detail

      • get

        public Object get​(long key)
        Returns the value mapped by the given key. Also promotes this key to the most recently used.
        Returns:
        the value or null if it cannot be found
      • put

        public void put​(long key,
                        Object value)
        Add the key/value pair to the map.