net.sourceforge.wurfl.core.cache
Class LRUMapCacheProvider

java.lang.Object
  extended by net.sourceforge.wurfl.core.cache.LRUMapCacheProvider
All Implemented Interfaces:
CacheProvider

public class LRUMapCacheProvider
extends Object
implements CacheProvider

CacheProvider LRUMap implementation.

The cached items are stored using LRUMap. LRUMap is a map using LRU algorithm to evict items.

Version:
$Id: LRUMapCacheProvider.java 432 2010-05-06 12:12:53Z filippo.deluca $
Author:
Fantayeneh Asres Gizaw, Filippo De Luca

Constructor Summary
LRUMapCacheProvider()
          Default constructor.
LRUMapCacheProvider(int maxSize)
          Constructor by maxSize parameter.
LRUMapCacheProvider(int maxSize, boolean scanUntilRemovable)
          Constructor by LRUMap parameters.
 
Method Summary
 void clear()
          Remove all items from cache.
 Object get(Object key)
          Returns the cached item.
 void put(Object key, Object value)
          Put an item in cache associated to a key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LRUMapCacheProvider

public LRUMapCacheProvider(int maxSize,
                           boolean scanUntilRemovable)
Constructor by LRUMap parameters. To more detail look at LRUMap documentation.

Parameters:
maxSize - The max size of cache.
scanUntilRemovable - scan until a removeable entry is found, default false.
See Also:
LRUMap.LRUMap(int, boolean)

LRUMapCacheProvider

public LRUMapCacheProvider(int maxSize)
Constructor by maxSize parameter.

Parameters:
maxSize - The max size of cache.
See Also:
LRUMap.LRUMap(int)

LRUMapCacheProvider

public LRUMapCacheProvider()
Default constructor.

Method Detail

clear

public void clear()
Description copied from interface: CacheProvider
Remove all items from cache.

Specified by:
clear in interface CacheProvider

get

public Object get(Object key)
Description copied from interface: CacheProvider
Returns the cached item.

Specified by:
get in interface CacheProvider
Parameters:
key - The cached item key.
Returns:
Cached Object, null if this cache does not contain it.

put

public void put(Object key,
                Object value)
Description copied from interface: CacheProvider
Put an item in cache associated to a key.

Specified by:
put in interface CacheProvider
Parameters:
key - The caching item key.
value - The caching item.


Copyright © 2008-2010 WURFL-Pro srl. All Rights Reserved.