Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.graph.connector.path.cache
Interface WorkspaceCache

All Known Implementing Classes:
  InMemoryWorkspaceCache

    @ThreadSafe
    public interface WorkspaceCache

The basic contract for a workspace-level cache of paths to the nodes stored at that path.

Implementations must provide a no-argument constructor in order to be instantiated by `PathRepositoryCache`. After instantiation, the `initialize(PathCachePolicy, String)` method will be called to inject the cache policy into the implementation.

Implementations must be thread-safe.

Method Summary
`void` | `clearStatistics()` Clears all statistics for this cache
`void` | `close()` Indicates that the cache is no longer in use and should relinquish any resources.
`PathNode` | `get(Path path)` Retrieves the cached node with the given path, it it exists and is valid
`CacheStatistics` | `getStatistics()`
`void` | `initialize(PathCachePolicy policy, String workspaceName)` Injects the cache policy into the cache
`void` | `invalidate(Path path)` Invalidates all nodes in the cache that have the given path or have a path that is an ancestor of the given path
`void` | `set(PathNode node)` Attempts to cache the given node.

Method Detail

### initialize

    void initialize(PathCachePolicy policy,
                    String workspaceName)

  Injects the cache policy into the cache

  Parameters:
    `policy` - the active cache policy for the repository source with which this cache is associated
    `workspaceName` - the name of the workspace that this cache is managing
  Throws:
    `IllegalStateException` - if this method is called on a cache that has already been initialized.

### clearStatistics

    void clearStatistics()

  Clears all statistics for this cache

### getStatistics

    CacheStatistics getStatistics()

  Returns:
    the statistics since the most recent of the cache initialization or the last call to `clearStatistics()`; never null

### get

    PathNode get(Path path)

  Retrieves the cached node with the given path, it it exists and is valid

  Parameters:
    `path` - the path for the node to be retrieved
  Returns:
    the cached node with the given path; may be null if no node with that path is cached or a node with that path is cached but is deemed invalid for implementation-specific reasons

### set

    void set(PathNode node)

  Attempts to cache the given node. Implementations must call `PathCachePolicy.shouldCache(PathNode)` on the policy from the `initialize(PathCachePolicy, String)` method to determine if the node should be cached.

  Parameters:
    `node` - the node that is to be cached; may not be null

### invalidate

    void invalidate(Path path)

  Invalidates all nodes in the cache that have the given path or have a path that is an ancestor of the given path

  Parameters:
    `path` - the root of the branch of nodes that are to be invalidated; may not be null

### close

    void close()

  Indicates that the cache is no longer in use and should relinquish any resources.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.