Interface Cache<K,​V>

  • All Known Implementing Classes:
    CacheAccessTracker, RecordCache

    public interface Cache<K,​V>
    Partial mapping of keys of type K to values of type Cache. If supported by the underlying implementation the mappings can further be associated with a cost, which is a metric for the cost occurring when the given mapping is lost. Higher values represent higher costs.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      V get​(K key)  
      void put​(K key, V value)
      Add a mapping from key to value.
      void put​(K key, V value, byte cost)
      Add a mapping from key to value with a given cost.
    • Method Detail

      • put

        void put​(@NotNull
                 K key,
                 @NotNull
                 V value)
        Add a mapping from key to value.
        Throws:
        java.lang.UnsupportedOperationException - if the underlying implementation doesn't support values without an associated cost and put(Object, Object, byte) should be used instead.
      • put

        void put​(@NotNull
                 K key,
                 @NotNull
                 V value,
                 byte cost)
        Add a mapping from key to value with a given cost.
        Throws:
        java.lang.UnsupportedOperationException - if the underlying implementation doesn't support values with an associated cost and put(Object, Object) should be used instead.
      • get

        @Nullable
        V get​(@NotNull
              K key)
        Returns:
        The mapping for key, or null if none.