net.sourceforge.wurfl.core.cache
Class EhCacheProvider

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

public class EhCacheProvider
extends Object
implements CacheProvider

CacheProvider's EhCache implementation.

Add EhCache support to WURFL api. for more info visit the EHCache site

Version:
$Id: EhCacheProvider.java 934 2012-03-27 13:34:26Z fulvio.crivellaro $

Field Summary
 
Fields inherited from interface net.sourceforge.wurfl.core.cache.CacheProvider
logger
 
Constructor Summary
EhCacheProvider()
          Default Constructor
EhCacheProvider(net.sf.ehcache.Cache cache)
          Constructor by EhCache cache
EhCacheProvider(EhCacheManager mgr)
          Simple custom constructor
 
Method Summary
 void clear()
          Remove all items from cache.
 net.sf.ehcache.Cache getCache()
          Returns the held 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.
 void setCache(net.sf.ehcache.Cache cache)
          Set the underlying cache instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EhCacheProvider

public EhCacheProvider()
Default Constructor


EhCacheProvider

public EhCacheProvider(net.sf.ehcache.Cache cache)
Constructor by EhCache cache

Parameters:
cache - Cache instance.

EhCacheProvider

public EhCacheProvider(EhCacheManager mgr)
Simple custom constructor

Parameters:
mgr -
Method Detail

getCache

public net.sf.ehcache.Cache getCache()
Returns the held cache.

Returns:
Held Cache instance.

setCache

public void setCache(net.sf.ehcache.Cache cache)
Set the underlying cache instance.

Parameters:
cache - The EhCache Cache instance.

clear

public void clear()
Remove all items from cache.

Specified by:
clear in interface CacheProvider

getDevice

public Device getDevice(String key)
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)
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.