org.apache.directmemory.memory
Interface MemoryManagerService<V>

All Known Implementing Classes:
MemoryManagerServiceImpl

public interface MemoryManagerService<V>


Method Summary
<T extends V>
Pointer<V>
allocate(Class<T> type, int size, long expiresIn, long expires)
           
 long capacity()
           
 void clear()
           
 long collectExpired()
           
 void collectLFU()
           
 void free(Pointer<V> pointer)
           
 void init(int numberOfBuffers, int size)
          Initialize the internal structure.
 byte[] retrieve(Pointer<V> pointer)
           
 Pointer<V> store(byte[] payload)
          Same function as store(byte[]), but add an relative expiration delta in milliseconds
 Pointer<V> store(byte[] payload, int expiresIn)
          Store function family.
 Pointer<V> update(Pointer<V> pointer, byte[] payload)
          Update value of a {@link Pointer
 long used()
           
 

Method Detail

init

void init(int numberOfBuffers,
          int size)
Initialize the internal structure. Need to be called before the service can be used.

Parameters:
numberOfBuffers - : number of internal bucket
size - : size in B of internal buckets

store

Pointer<V> store(byte[] payload,
                 int expiresIn)
Store function family. Store the given payload at a certain offset in a MemoryBuffer, returning the pointer to the value.

Parameters:
payload - : the data to store
Returns:
the pointer to the value, or null if not enough space has been found.

store

Pointer<V> store(byte[] payload)
Same function as store(byte[]), but add an relative expiration delta in milliseconds

Parameters:
payload - : the data to store
expiresIn - : relative amount of milliseconds the data will expire
Returns:
the pointer to the value, or null if not enough space has been found.

update

Pointer<V> update(Pointer<V> pointer,
                  byte[] payload)
Update value of a {@link Pointer

Parameters:
pointer -
payload -
Returns:

retrieve

byte[] retrieve(Pointer<V> pointer)

free

void free(Pointer<V> pointer)

clear

void clear()

capacity

long capacity()

used

long used()

collectExpired

long collectExpired()

collectLFU

void collectLFU()

allocate

<T extends V> Pointer<V> allocate(Class<T> type,
                                  int size,
                                  long expiresIn,
                                  long expires)


Copyright © 2011-2012 The Apache Software Foundation. All Rights Reserved.