Interface CuratorCacheStorage
-
- All Superinterfaces:
CuratorCacheAccessor
public interface CuratorCacheStorage extends CuratorCacheAccessor
Interface for maintaining data in aCuratorCache
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()Reset the storage to zero entriesstatic CuratorCacheStoragedataNotCached()Return a new storage instance that does not retain the data bytes.java.util.Optional<ChildData>get(java.lang.String path)Return an entry from storagejava.util.Optional<ChildData>put(ChildData data)Add an entry to storage and return any previous entry at that pathjava.util.Optional<ChildData>remove(java.lang.String path)Remove the entry from storage and return any previous entry at that pathintsize()Return the current number of entries in storagestatic CuratorCacheStoragestandard()Return a new standard storage instancejava.util.stream.Stream<ChildData>stream()Return a stream over the storage entries.
-
-
-
Method Detail
-
standard
static CuratorCacheStorage standard()
Return a new standard storage instance- Returns:
- storage instance
-
dataNotCached
static CuratorCacheStorage dataNotCached()
Return a new storage instance that does not retain the data bytes. i.e. ChildData objects returned by this storage will always returnnullforChildData.getData().- Returns:
- storage instance that does not retain data bytes
-
put
java.util.Optional<ChildData> put(ChildData data)
Add an entry to storage and return any previous entry at that path- Parameters:
data- entry to add- Returns:
- previous entry or
empty()
-
remove
java.util.Optional<ChildData> remove(java.lang.String path)
Remove the entry from storage and return any previous entry at that path- Parameters:
path- path to remove- Returns:
- previous entry or
empty()
-
clear
void clear()
Reset the storage to zero entries
-
get
java.util.Optional<ChildData> get(java.lang.String path)
Return an entry from storage- Specified by:
getin interfaceCuratorCacheAccessor- Parameters:
path- path to get- Returns:
- entry or
empty()
-
size
int size()
Return the current number of entries in storage- Specified by:
sizein interfaceCuratorCacheAccessor- Returns:
- number of entries
-
stream
java.util.stream.Stream<ChildData> stream()
Return a stream over the storage entries. Note: for a standard storage instance, the stream behaves like a stream returned byConcurrentHashMap.entrySet()- Specified by:
streamin interfaceCuratorCacheAccessor- Returns:
- stream over entries
-
-