net.sourceforge.wurfl.core.cache
Class DoubleLRUMapCacheProvider

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

public class DoubleLRUMapCacheProvider
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 768 2012-01-03 22:24:11Z ermanno.franco $

Field Summary
 
Fields inherited from interface net.sourceforge.wurfl.core.cache.CacheProvider
logger
 
Constructor Summary
DoubleLRUMapCacheProvider()
          Default constructor.
DoubleLRUMapCacheProvider(int maxSizeUA, int maxSizeDevice)
          Constructor by maxSize parameters.
DoubleLRUMapCacheProvider(int maxSizeUA, int maxSizeDevice, boolean scanUntilRemovable)
          Constructor by LRUMap parameters.
 
Method Summary
 void clear()
          Remove all items from cache.
 Device getDevice(String key)
          Returns the cached item.
 Device getDeviceFromDeviceId(String deviceId)
          Returns the cached device, from the deviceId.
 void putDevice(String key, Device 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

DoubleLRUMapCacheProvider

public DoubleLRUMapCacheProvider(int maxSizeUA,
                                 int maxSizeDevice,
                                 boolean scanUntilRemovable)
Constructor by LRUMap parameters. To more detail look at LRUMap documentation.

Parameters:
maxSizeUA - The max size of cached UAs.
maxSixeDevice - The max size of cached Devices
scanUntilRemovable - scan until a removeable entry is found, default false.
See Also:
LRUMap.LRUMap(int, boolean)

DoubleLRUMapCacheProvider

public DoubleLRUMapCacheProvider(int maxSizeUA,
                                 int maxSizeDevice)
Constructor by maxSize parameters.

Parameters:
maxSizeUA - The max size of cached UAs.
maxSixeDevice - The max size of cached Devices
See Also:
LRUMap.LRUMap(int)

DoubleLRUMapCacheProvider

public DoubleLRUMapCacheProvider()
Default constructor. Instantiates the maps with default sizes of 10000 for the UA > ID map, and 2000 for the ID > Device.

Method Detail

clear

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

Specified by:
clear in interface CacheProvider

getDevice

public Device getDevice(String key)
Description copied from interface: CacheProvider
Returns the cached item.

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

putDevice

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

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

getDeviceFromDeviceId

public Device getDeviceFromDeviceId(String deviceId)
Description copied from interface: CacheProvider
Returns the cached device, from the deviceId.

Specified by:
getDeviceFromDeviceId in interface CacheProvider
Returns:
Cached Device, null if this cache does not contain it.


Copyright © 2012 ScientiaMobile Inc.. All Rights Reserved.