2015/07/26 - Apache DirectMemory has been retired.

For more information, please explore the Attic.

DirectMemory Simple Usage

Add a dependency to the DirectMemory cache artifact:


Create your CacheService instance:

  CacheService<Object, Object> cacheService = new DirectMemory<Object, Object>()
    .setNumberOfBuffers( 10 )
    .setSize( 1000 )
    .setInitialCapacity( 100000 )
    .setConcurrencyLevel( 4 )

Use the cache service to store object, Those methods returns a Pointer if this pointer is null your object has not been stored:

  put( K key, V value )
  put( K key, V value, int expiresIn )

Retrieve an Object from the cache service:

  V retrieve( K key );

Clear at the end of usage and close the CacheService

  cacheService.close(); // close() is available in 0.2+ only