com.bigdata.cache
Interface IGlobalLRU.ILRUCache<K,V>

Type Parameters:
K - The key (the address in an IRawStore)
V - The value (typically an IDataRecordAccess implementation).
Enclosing interface:
IGlobalLRU<K,V>

public static interface IGlobalLRU.ILRUCache<K,V>

Interface for cache of read-only records from a specific IRawStore backed by a shared LRU.

Version:
$Id: IGlobalLRU.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Method Summary
 void clear()
          Removes all entries from the cache and the backing LRU.
 V get(K k)
          Return the object under the key from the cache or null if there is no entry in the cache for that key.
 IAddressManager getAddressManager()
          An IAddressManager which can be used to decode the byte count of a record on the disk given the long address of that record.
 UUID getStoreUUID()
          The UUID of the associated store.
 V putIfAbsent(K k, V v)
          Insert or "touch" this object in the cache.
 V remove(K k)
          Remove the object under the key from the cache.
 int size()
          Return the #of entries in the cache.
 

Method Detail

getStoreUUID

UUID getStoreUUID()
The UUID of the associated store.


getAddressManager

IAddressManager getAddressManager()
An IAddressManager which can be used to decode the byte count of a record on the disk given the long address of that record. This MUST NOT cause the corresponding IRawStore reference to be maintained as that would prevent many IRawStore from being closed by their finalizer.


putIfAbsent

V putIfAbsent(K k,
              V v)
Insert or "touch" this object in the cache. If an object already exists for the given key, then the access order of the entry is updated and the existing object is returned.

Note: For a IWORM store, the address is always new so there will not be an entry in the cache for that address.

Note: For a IRW store, the addresses can be reused and the delete of the old address MUST have cleared the entry for that address from the store's cache.

Parameters:
k - The key.
v - The value.
Returns:
The existing object in the cache -or- null iff this given object was inserted into the cache.
Throws:
IllegalStateException - If a different object is in the cache under the specified object identifier.

get

V get(K k)
Return the object under the key from the cache or null if there is no entry in the cache for that key.

Parameters:
k - The key.
Returns:
The object or null iff it is not in cache.

remove

V remove(K k)
Remove the object under the key from the cache.

Parameters:
k - The key.
Returns:
The object in the cache for that key or null if there was no entry for that key.

clear

void clear()
Removes all entries from the cache and the backing LRU.


size

int size()
Return the #of entries in the cache.



Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.