Class LruCache<Key,​Value extends CanEstimateSize>


  • public class LruCache<Key,​Value extends CanEstimateSize>
    extends java.lang.Object
    Caches values in simple least-recently-accessed order.
    • Constructor Detail

      • LruCache

        public LruCache​(int maxSizeEntries,
                        long maxSizeBytes,
                        boolean accessOrder)
    • Method Detail

      • get

        public Value get​(Key key)
        Returns an entry from the cache.
        Parameters:
        key - cache key
        Returns:
        entry from cache or null if cache does not contain given key.
      • borrow

        public Value borrow​(Key key)
                     throws java.sql.SQLException
        Borrows an entry from the cache.
        Parameters:
        key - cache key
        Returns:
        entry from cache or newly created entry if cache does not contain given key.
        Throws:
        java.sql.SQLException - if entry creation fails
      • put

        public void put​(Key key,
                        Value value)
        Returns given value to the cache
        Parameters:
        key - key
        value - value