com.thinkaurelius.titan.graphdb.transaction.vertexcache

## Class LRUVertexCache

- java.lang.Object
- - com.thinkaurelius.titan.graphdb.transaction.vertexcache.LRUVertexCache

- All Implemented Interfaces:
    VertexCache

      public class LRUVertexCache
      extends Object
      implements VertexCache

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LRUVertexCache(int capacity)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(InternalVertex vertex, long id)` Adds the given vertex with the given id to the cache.
    `void` | `close()` Closes the cache which allows the cache to release allocated memory.
    `boolean` | `contains(long id)` Checks whether the cache contains a vertex with the given id
    `InternalVertex` | `get(long id, Retriever<Long,InternalVertex> retriever)` Returns the vertex with the given id or null if it is not in the cache
    `List<InternalVertex>` | `getAllNew()` Returns an iterable over all new vertices in the cache

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LRUVertexCache

          public LRUVertexCache(int capacity)

  - ### Method Detail

    - #### contains

          public boolean contains(long id)

      Description copied from interface: `VertexCache`
      Checks whether the cache contains a vertex with the given id
      Specified by:
        `contains` in interface `VertexCache`
      Parameters:
        `id` - Vertex id
      Returns:
        true if a vertex with the given id is contained, else false

    - #### get

          public InternalVertex get(long id,
                           Retriever<Long,InternalVertex> retriever)

      Description copied from interface: `VertexCache`
      Returns the vertex with the given id or null if it is not in the cache
      Specified by:
        `get` in interface `VertexCache`
      Returns:

    - #### add

          public void add(InternalVertex vertex,
                 long id)

      Description copied from interface: `VertexCache`
      Adds the given vertex with the given id to the cache. The given vertex may already be in the cache. In other words, this method may be called to ensure that a vertex is still in the cache.
      Specified by:
        `add` in interface `VertexCache`

    - #### getAllNew

          public List<InternalVertex> getAllNew()

      Description copied from interface: `VertexCache`
      Returns an iterable over all new vertices in the cache
      Specified by:
        `getAllNew` in interface `VertexCache`
      Returns:

    - #### close

          public void close()

      Description copied from interface: `VertexCache`
      Closes the cache which allows the cache to release allocated memory. Calling any of the other methods after closing a cache has undetermined behavior.
      Specified by:
        `close` in interface `VertexCache`

Copyright © 2012–2014. All rights reserved.