Package jetbrains.buildServer.util
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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BinaryDataCache.Entry
get(String key)
Returns the content element associated with the key.boolean
hasEntry(String key)
Whether some value with the key is present in the cachevoid
invalidate(String key)
Invalidates the data associated with the key.void
put(String key, InputStream stream)
Stores the data presented by the stream object for the given key.void
putBytes(String key, byte[] bytes)
Stores the data presented by the byte array for the given key.
-
-
-
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 keystream
- 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. Usingput(String, java.io.InputStream)
is preferable unless you have binary data in memory.- Parameters:
key
- the keybytes
- 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
-
-