Interface BinaryDataCache

  • All Known Implementing Classes:
    PersistentBinaryDataCache

    public interface BinaryDataCache
    Represents a cache for storing streamable binary data. The keys of cached data are strings.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  BinaryDataCache.Entry
      Represents a data element stored in the cache
    • Method Detail

      • get

        @Nullable
        BinaryDataCache.Entry get​(@NotNull
                                  String key)
        Returns the content element associated with the key.
        Parameters:
        key - the key
        Returns:
        the element or null if no entry is present in the cache.
      • put

        void put​(@NotNull
                 String key,
                 @Nullable
                 InputStream stream)
        Stores the data presented by the stream object for the given key. The caller is responsible for closing the stream.
        Parameters:
        key - the key
        stream - the data stream. Null is acceptable.
      • putBytes

        void putBytes​(@NotNull
                      String key,
                      @Nullable
                      byte[] bytes)
        Stores the data presented by the byte array for the given key. Using put(String, java.io.InputStream) is preferable unless you have binary data in memory.
        Parameters:
        key - the key
        bytes - the data. Null is acceptable.
      • invalidate

        void invalidate​(@NotNull
                        String key)
        Invalidates the data associated with the key.
        Parameters:
        key - the key
      • hasEntry

        boolean hasEntry​(@NotNull
                         String key)
        Whether some value with the key is present in the cache
        Parameters:
        key - the key
        Returns:
        true if present (even null) and false otherwise