Interface CuratorCacheStorage

All Superinterfaces:
CuratorCacheAccessor

public interface CuratorCacheStorage extends CuratorCacheAccessor
Interface for maintaining data in a CuratorCache
  • Method Details

    • 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 return null for ChildData.getData().
      Returns:
      storage instance that does not retain data bytes
    • put

      Add an entry to storage and return any previous entry at that path
      Parameters:
      data - entry to add
      Returns:
      previous entry or empty()
    • remove

      Optional<ChildData> remove(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

      Return an entry from storage
      Specified by:
      get in interface CuratorCacheAccessor
      Parameters:
      path - path to get
      Returns:
      entry or empty()
    • size

      int size()
      Return the current number of entries in storage
      Specified by:
      size in interface CuratorCacheAccessor
      Returns:
      number of entries
    • stream

      Stream<ChildData> stream()
      Return a stream over the storage entries. Note: for a standard storage instance, the stream behaves like a stream returned by ConcurrentHashMap.entrySet()
      Specified by:
      stream in interface CuratorCacheAccessor
      Returns:
      stream over entries