Interface ResumeCache<K>

  • Type Parameters:
    K - the type of the key

    public interface ResumeCache<K>
    This cache stored the resumed data from a ResumeStrategy.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void add​(K key, Object offsetValue)
      Adds a value to the cache
      long capacity()
      Gets the cache pool size
      Object computeIfAbsent​(K key, Function<? super K,​? super Object> mapping)
      If the specified key is not present, compute its value from the mapping function (like Java's standard Map one)
      Object computeIfPresent​(K key, BiFunction<? super K,​? super Object,​? super Object> remapping)
      If the specified key is present, compute a new value from the mapping function (like Java's standard Map one)
      boolean contains​(K key, Object entry)
      Whether the cache contains the key with the given entry value
      void forEach​(BiFunction<? super K,​? super Object,​Boolean> action)
      Performs the given action for each member of the cache
      Object get​(K key)
      Gets the offset entry for the key
      <T> T get​(K key, Class<T> clazz)
      Gets the offset entry for the key
      boolean isFull()
      Checks whether the cache is full
    • Method Detail

      • computeIfAbsent

        Object computeIfAbsent​(K key,
                               Function<? super K,​? super Object> mapping)
        If the specified key is not present, compute its value from the mapping function (like Java's standard Map one)
        Parameters:
        key - the key to get or associate with the value
        mapping - the mapping function used to compute the value
        Returns:
        the value associated with the key (either the present or the one computed from the mapping function)
      • computeIfPresent

        Object computeIfPresent​(K key,
                                BiFunction<? super K,​? super Object,​? super Object> remapping)
        If the specified key is present, compute a new value from the mapping function (like Java's standard Map one)
        Parameters:
        key - the key to get or associate with the value
        remapping - the remapping function used to compute the new value
        Returns:
        the value associated with the key (either the present or the one computed from the mapping function)
      • contains

        boolean contains​(K key,
                         Object entry)
        Whether the cache contains the key with the given entry value
        Parameters:
        key - the key
        entry - the entry
        Returns:
        true if the key/entry pair is stored in the cache
      • add

        void add​(K key,
                 Object offsetValue)
        Adds a value to the cache
        Parameters:
        key - the key to add
        offsetValue - the offset value
      • isFull

        boolean isFull()
        Checks whether the cache is full
        Returns:
        true if full, or false otherwise
      • capacity

        long capacity()
        Gets the cache pool size
      • get

        <T> T get​(K key,
                  Class<T> clazz)
        Gets the offset entry for the key
        Parameters:
        key - the key
        clazz - the class object representing the value to be obtained
        Returns:
        the offset value wrapped in an optional
      • get

        Object get​(K key)
        Gets the offset entry for the key
        Parameters:
        key - the key
        Returns:
        the offset value
      • forEach

        void forEach​(BiFunction<? super K,​? super Object,​Boolean> action)
        Performs the given action for each member of the cache
        Parameters:
        action - the action to execute