Class AbstractDelegatingInternalDataContainer<K,​V>

    • Constructor Detail

      • AbstractDelegatingInternalDataContainer

        public AbstractDelegatingInternalDataContainer()
    • Method Detail

      • touch

        public boolean touch​(int segment,
                             Object k,
                             long currentTimeMillis)
        Description copied from interface: InternalDataContainer
        Touches an entry in the data container. This will update the last access time of the entry as well as count this as a access for eviction based recency.
        Specified by:
        touch in interface InternalDataContainer<K,​V>
        Parameters:
        segment - segment for the key
        k - key under which entry is stored
        currentTimeMillis - the current time in milliseconds to touch the entry with
        Returns:
        true if the entry timestamp was touched
      • put

        public void put​(int segment,
                        K k,
                        V v,
                        Metadata metadata,
                        long createdTimestamp,
                        long lastUseTimestamp)
        Description copied from interface: InternalDataContainer
        Same as DataContainer.put(Object, Object, Metadata) except that the segment of the key can provided to write/lookup entries without calculating the segment for the given key.

        Note: The timestamps ignored if the entry already exists in the data container.

        Specified by:
        put in interface InternalDataContainer<K,​V>
        Parameters:
        segment - segment for the key
        k - key under which to store entry
        v - value to store
        metadata - metadata of the entry
        createdTimestamp - creation timestamp, or -1 to use the current time
        lastUseTimestamp - last use timestamp, or -1 to use the current time
      • containsKey

        public boolean containsKey​(int segment,
                                   Object k)
        Description copied from interface: InternalDataContainer
        Same as DataContainer.containsKey(Object) except that the segment of the key can provided to lookup if the entry exists without calculating the segment for the given key.
        Specified by:
        containsKey in interface InternalDataContainer<K,​V>
        Parameters:
        segment - segment for the key
        k - key under which entry is stored
        Returns:
        true if entry exists and has not expired; false otherwise
      • evict

        public void evict​(int segment,
                          K key)
        Description copied from interface: InternalDataContainer
        Same as DataContainer.evict(Object) except that the segment of the key can provided to remove the entry without calculating the segment for the given key.
        Specified by:
        evict in interface InternalDataContainer<K,​V>
        Parameters:
        segment - segment for the key
        key - The key to evict.
      • clear

        public void clear​(org.infinispan.commons.util.IntSet segments)
        Description copied from interface: InternalDataContainer
        Removes entries from the container whose key maps to one of the provided segments
        Specified by:
        clear in interface InternalDataContainer<K,​V>
        Parameters:
        segments - segments of entries to remove
      • spliterator

        public Spliterator<InternalCacheEntry<K,​V>> spliterator​(org.infinispan.commons.util.IntSet segments)
        Description copied from interface: InternalDataContainer
        Same as DataContainer.spliterator() except that only entries that map to the provided segments are returned via this spliterator. The spliterator will not return expired entries.
        Specified by:
        spliterator in interface InternalDataContainer<K,​V>
        Parameters:
        segments - segments of entries to return
        Returns:
        spliterator containing entries mapping to those segments that aren't expired
      • iterator

        public Iterator<InternalCacheEntry<K,​V>> iterator​(org.infinispan.commons.util.IntSet segments)
        Description copied from interface: InternalDataContainer
        Same as DataContainer.iterator() except that only entries that map to the provided segments are returned via the iterator. The iterator will not return expired entries.
        Specified by:
        iterator in interface InternalDataContainer<K,​V>
        Parameters:
        segments - segments of entries to use
        Returns:
        iterator that returns all entries mapped to the given segments
      • forEach

        public void forEach​(org.infinispan.commons.util.IntSet segments,
                            Consumer<? super InternalCacheEntry<K,​V>> action)
        Description copied from interface: InternalDataContainer
        Performs the given action for each element of the container that maps to the given set of segments until all elements have been processed or the action throws an exception. Unless otherwise specified by the implementing class, actions are performed in the order of iteration (if an iteration order is specified). Exceptions thrown by the action are relayed to the caller.
        Specified by:
        forEach in interface InternalDataContainer<K,​V>
        action - The action to be performed for each element
      • size

        public int size​(org.infinispan.commons.util.IntSet segments)
        Description copied from interface: InternalDataContainer
        Returns how many entries are present in the data container that map to the given segments without counting entries that are currently expired.
        Specified by:
        size in interface InternalDataContainer<K,​V>
        Parameters:
        segments - segments of entries to count
        Returns:
        count of the number of entries in the container excluding expired entries
      • sizeIncludingExpired

        public int sizeIncludingExpired​(org.infinispan.commons.util.IntSet segments)
        Description copied from interface: InternalDataContainer
        Returns how many entries are present in the data container that map to the given segments including any entries that may be expired
        Specified by:
        sizeIncludingExpired in interface InternalDataContainer<K,​V>
        Parameters:
        segments - segments of entries to count
        Returns:
        count of the number of entries in the container including expired entries
      • addSegments

        public void addSegments​(org.infinispan.commons.util.IntSet segments)
        Description copied from interface: InternalDataContainer
        Sets what segments this data container should be using. Already associated segments are unaffected by this and takes a union of existing and new segments.
        Specified by:
        addSegments in interface InternalDataContainer<K,​V>
        Parameters:
        segments - segments to associate with this container
      • removeSegments

        public void removeSegments​(org.infinispan.commons.util.IntSet segments)
        Description copied from interface: InternalDataContainer
        Removes and un-associates the given segments. This will notify any listeners registered via InternalDataContainer.addRemovalListener(Consumer) of entries that were removed due to no longer being associated with this container. There is no guarantee if the consumer is invoked once or multiple times for a given group of segments and could be in any order.

        When this method is invoked an implementation is free to remove any entries that don't map to segments currently associated with this container. Note that entries that were removed due to their segments never being associated with this container do not notify listeners registered via InternalDataContainer.addRemovalListener(Consumer).

        Specified by:
        removeSegments in interface InternalDataContainer<K,​V>
        Parameters:
        segments - segments that should no longer be associated with this container