-
Notifications
You must be signed in to change notification settings - Fork 434
Path Cache
Randgalt edited this page Nov 18, 2011
·
10 revisions
A Path Cache is used to watch a ZNode. Whenever a child is added, updated or removed, the Path Cache will change its state to contain the current set of children, the children's data and the children's state.
- PathChildrenCache
- PathChildrenCacheMode
- PathChildrenCacheListener
- ChildData
public PathChildrenCache(CuratorFramework client,
String path,
PathChildrenCacheMode mode)
Parameters:
client - the client
path - path to watch
mode - caching mode
PathChildrenCacheMode values:
- CACHE_DATA_AND_STAT - The cache will hold all the children, the data for each child node and the stat for each child node
- CACHE_DATA - The cache will hold all the children and the data for each child node.
ChildData.getStat()
will returnnull
. - CACHE_PATHS_ONLY - The cache will hold only the children path names.
ChildData.getStat()
andChildData.getData()
will both returnnull
.
The cache must be started by calling start()
. Call close()
when you are through with the cache.
At any time, call getCurrentData()
to get the current state of the cache. You can also register to be notified when a change occurs by calling:
public void addListener(PathChildrenCacheListener listener)
Add a change listener
Parameters:
listener - the listener
PathChildrenCache instances internally monitor a ConnectionStateListener
. If a SUSPEND or LOST is received, the cache is reset (the PathChildrenCacheListener
will receive a RESET).
- Curator
- Javadoc
- Coverage Report
- Getting Started
- Examples
- FAQ
- Client
- Framework
-
Recipes
- Leader Latch
- Leader Election
- Shared Reentrant Lock
- Shared Lock
- Shared Reentrant Read Write Lock
- Shared Semaphore
- Multi Shared Lock
- Distributed Queue
- Distributed Id Queue
- Distributed Priority Queue
- Distributed Delay Queue
- Simple Distributed Queue
- Barrier
- Double Barrier
- Shared counter
- Distributed Atomic Long
- Path Cache
- Node Cache
- Utilities – Test Server, Test Cluster, ZKPaths, EnsurePath, QueueSharder, Reaper, ChildReaper
- Tech Notes
- Errors
- Exhibitor Integration
- Extensions
- Logging and Tracing