org.infinispan.container
Interface DataContainer

All Superinterfaces:
Iterable<InternalCacheEntry>
All Known Implementing Classes:
FIFODataContainer, LRUDataContainer, SimpleDataContainer, SpinLockBasedFIFODataContainer, SpinLockBasedLRUDataContainer

public interface DataContainer
extends Iterable<InternalCacheEntry>

The main internal data structure which stores entries

Since:
4.0
Author:
Manik Surtani (manik@jboss.org)

Method Summary
 void clear()
          Removes all entries in the container
 boolean containsKey(Object k)
          Tests whether an entry exists in the container
 InternalCacheEntry get(Object k)
          Retrieves a cached entry
 Set<Object> keySet()
           
 void purgeExpired()
          Purges entries that have passed their expiry time
 void put(Object k, Object v, long lifespan, long maxIdle)
          Puts an entry in the cache along with a lifespan and a maxIdle time
 InternalCacheEntry remove(Object k)
          Removes an entry from the cache
 int size()
           
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

get

InternalCacheEntry get(Object k)
Retrieves a cached entry

Parameters:
k - key under which entry is stored
Returns:
entry, if it exists and has not expired, or null if not

put

void put(Object k,
         Object v,
         long lifespan,
         long maxIdle)
Puts an entry in the cache along with a lifespan and a maxIdle time

Parameters:
k - key under which to store entry
v - value to store
lifespan - lifespan in milliseconds. -1 means immortal.
maxIdle - max idle time for which to store entry. -1 means forever.

containsKey

boolean containsKey(Object k)
Tests whether an entry exists in the container

Parameters:
k - key to test
Returns:
true if entry exists and has not expired; false otherwise

remove

InternalCacheEntry remove(Object k)
Removes an entry from the cache

Parameters:
k - key to remove
Returns:
entry removed, or null if it didn't exist or had expired

size

int size()
Returns:
count of the number of entries in the container

clear

void clear()
Removes all entries in the container


keySet

Set<Object> keySet()
Returns:
a set of keys contained in the container

purgeExpired

void purgeExpired()
Purges entries that have passed their expiry time



Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.