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
Class InMemoryWorkspaceCache

    java.lang.Object
      org.modeshape.graph.connector.path.cache.InMemoryWorkspaceCache

All Implemented Interfaces:
  WorkspaceCache

    @ThreadSafe
    public class InMemoryWorkspaceCache

extends Object
implements WorkspaceCache

Implementation of `WorkspaceCache` that stores all nodes in-memory.

Nested Class Summary
`static class` | `InMemoryWorkspaceCache.InMemoryCachePolicy` Trivial path cache policy implementation that caches all nodes in an in-memory cache.

Constructor Summary
`InMemoryWorkspaceCache()`

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
`protected PathCachePolicy` | `policy()`
`void` | `set(PathNode node)` Attempts to cache the given node.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### InMemoryWorkspaceCache

    public InMemoryWorkspaceCache()

Method Detail

### initialize

    public void initialize(PathCachePolicy policy,
                           String workspaceName)

  Description copied from interface: `WorkspaceCache`
  Injects the cache policy into the cache

  Specified by:
    `initialize` in interface `WorkspaceCache`
  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

### policy

    protected PathCachePolicy policy()

### clearStatistics

    public void clearStatistics()

  Description copied from interface: `WorkspaceCache`
  Clears all statistics for this cache

  Specified by:
    `clearStatistics` in interface `WorkspaceCache`

### getStatistics

    public CacheStatistics getStatistics()

  Specified by:
    `getStatistics` in interface `WorkspaceCache`
  Returns:
    the statistics since the most recent of the cache initialization or the last call to `WorkspaceCache.clearStatistics()`; never null

### get

    public PathNode get(Path path)

  Description copied from interface: `WorkspaceCache`
  Retrieves the cached node with the given path, it it exists and is valid

  Specified by:
    `get` in interface `WorkspaceCache`
  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

    public void set(PathNode node)

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

  Specified by:
    `set` in interface `WorkspaceCache`
  Parameters:
    `node` - the node that is to be cached; may not be null

### invalidate

    public void invalidate(Path path)

  Description copied from interface: `WorkspaceCache`
  Invalidates all nodes in the cache that have the given path or have a path that is an ancestor of the given path

  Specified by:
    `invalidate` in interface `WorkspaceCache`
  Parameters:
    `path` - the root of the branch of nodes that are to be invalidated; may not be null

### close

    public void close()

  Description copied from interface: `WorkspaceCache`
  Indicates that the cache is no longer in use and should relinquish any resources.

  Specified by:
    `close` in interface `WorkspaceCache`

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-2011 JBoss, a division of Red Hat. All Rights Reserved.