Interface DataContainer<K,​V>

    • Method Detail

      • get

        @Deprecated
        InternalCacheEntry<K,​V> get​(Object k)
        Deprecated.
        since 10.1 - Please use peek(Object) instead.
        Retrieves a cached entry
        Parameters:
        k - key under which entry is stored
        Returns:
        entry, if it exists and has not expired, or null if not
      • peek

        InternalCacheEntry<K,​V> peek​(Object k)
        Retrieves a cache entry in the same way as get(Object)} except that it does not update or reorder any of the internal constructs. I.e., expiration does not happen, and in the case of the LRU container, the entry is not moved to the end of the chain.

        This method should be used instead of get(Object)} when called while iterating through the data container using methods like iterator() to avoid changing the underlying collection's order.

        Parameters:
        k - key under which entry is stored
        Returns:
        entry, if it exists, or null if not
      • put

        void put​(K k,
                 V v,
                 Metadata metadata)
        Puts an entry in the cache along with metadata adding information such lifespan of entry, max idle time, version information...etc.

        The key must be activate by invoking ActivationManager.activateAsync(Object, int) boolean)}.

        Parameters:
        k - key under which to store entry
        v - value to store
        metadata - metadata of the entry
      • containsKey

        boolean containsKey​(Object k)
        Tests whether an entry exists in the container
        Parameters:
        k - key to test
        Returns:
        true if entry exists and has not expired; false otherwise
      • size

        default int size()
        Returns:
        count of the number of entries in the container excluding expired entries
      • sizeIncludingExpired

        int sizeIncludingExpired()
        Returns:
        count of the number of entries in the container including expired entries
      • clear

        void clear()
        Removes all entries in the container
      • iterator

        Iterator<InternalCacheEntry<K,​V>> iterator()

        This iterator only returns entries that are not expired, however it will not remove them while doing so.

        Specified by:
        iterator in interface Iterable<K>
        Returns:
        iterator that doesn't produce expired entries
      • spliterator

        default Spliterator<InternalCacheEntry<K,​V>> spliterator()

        This spliterator only returns entries that are not expired, however it will not remove them while doing so.

        Specified by:
        spliterator in interface Iterable<K>
        Returns:
        spliterator that doesn't produce expired entries
      • iteratorIncludingExpired

        Iterator<InternalCacheEntry<K,​V>> iteratorIncludingExpired()
        Same as iterator() except that is also returns expired entries.
        Returns:
        iterator that returns all entries including expired ones
      • spliteratorIncludingExpired

        default Spliterator<InternalCacheEntry<K,​V>> spliteratorIncludingExpired()
        Same as spliterator() except that is also returns expired entries.
        Returns:
        spliterator that returns all entries including expired ones
      • resize

        default void resize​(long newSize)
        Resizes the capacity of the underlying container. This is only supported if the container is bounded. An UnsupportedOperationException is thrown otherwise.
        Parameters:
        newSize - the new size
      • capacity

        default long capacity()
        Returns the capacity of the underlying container. This is only supported if the container is bounded. An UnsupportedOperationException is thrown otherwise.
        Returns:
      • evictionSize

        default long evictionSize()
        Returns how large the eviction size is currently. This is only supported if the container is bounded. An UnsupportedOperationException is thrown otherwise. This value will always be lower than the value returned from capacity()
        Returns:
        how large the counted eviction is