info.magnolia.module.cache.ehcache
Class EhCacheWrapper

java.lang.Object
  extended by info.magnolia.module.cache.ehcache.EhCacheWrapper
All Implemented Interfaces:
BlockingCache, Cache

public class EhCacheWrapper
extends Object
implements BlockingCache

Magnolia cache wrapper for underlying ehCache implementation.

Version:
$Revision: $ ($Author: $)
Author:
gjoseph

Constructor Summary
EhCacheWrapper(net.sf.ehcache.constructs.blocking.BlockingCache ehcache, CacheMonitor cacheMonitor, String name)
           
EhCacheWrapper(net.sf.ehcache.Ehcache ehcache, CacheMonitor cacheMonitor, String name)
           
 
Method Summary
 void clear()
           
 Object get(Object key)
           
 int getBlockingTimeout()
          If the timeout is reached an exception is thrown to unlock the blocked thread (in milliseconds).
 String getName()
           
 int getSize()
           
 net.sf.ehcache.Ehcache getWrappedEhcache()
           
 boolean hasElement(Object key)
           
 void put(Object key, Object value)
           
 void put(Object key, Object value, int timeToLiveInSeconds)
           
 void remove(Object key)
           
 void unlock(Object key)
          Will unlock the key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EhCacheWrapper

public EhCacheWrapper(net.sf.ehcache.constructs.blocking.BlockingCache ehcache,
                      CacheMonitor cacheMonitor,
                      String name)

EhCacheWrapper

public EhCacheWrapper(net.sf.ehcache.Ehcache ehcache,
                      CacheMonitor cacheMonitor,
                      String name)
Method Detail

get

public Object get(Object key)
Specified by:
get in interface Cache

hasElement

public boolean hasElement(Object key)
Specified by:
hasElement in interface Cache

put

public void put(Object key,
                Object value)
Specified by:
put in interface Cache

put

public void put(Object key,
                Object value,
                int timeToLiveInSeconds)
Specified by:
put in interface Cache

remove

public void remove(Object key)
Specified by:
remove in interface Cache

clear

public void clear()
Specified by:
clear in interface Cache

unlock

public void unlock(Object key)
Description copied from interface: BlockingCache
Will unlock the key.

Specified by:
unlock in interface BlockingCache

getBlockingTimeout

public int getBlockingTimeout()
Description copied from interface: BlockingCache
If the timeout is reached an exception is thrown to unlock the blocked thread (in milliseconds). This guarantees that not all threads are waiting on a non-available resource.

Specified by:
getBlockingTimeout in interface BlockingCache

getWrappedEhcache

public net.sf.ehcache.Ehcache getWrappedEhcache()

getName

public String getName()
Specified by:
getName in interface Cache

getSize

public int getSize()
Specified by:
getSize in interface Cache


Copyright © 2003–2014 Magnolia International Ltd.. All rights reserved.