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 java.lang.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, java.lang.String name)
           
EhCacheWrapper(net.sf.ehcache.Ehcache ehcache, java.lang.String name)
           
 
Method Summary
 void clear()
           
 java.lang.Object get(java.lang.Object key)
           
 int getBlockingTimeout()
          If the timeout is reached an exception is thrown to unlock the blocked thread (in milliseconds).
 java.lang.String getName()
           
 int getSize()
           
 net.sf.ehcache.Ehcache getWrappedEhcache()
           
 boolean hasElement(java.lang.Object key)
           
 void put(java.lang.Object key, java.lang.Object value)
           
 void remove(java.lang.Object key)
           
 void unlock(java.lang.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,
                      java.lang.String name)

EhCacheWrapper

public EhCacheWrapper(net.sf.ehcache.Ehcache ehcache,
                      java.lang.String name)
Method Detail

get

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

hasElement

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

put

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

remove

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

clear

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

unlock

public void unlock(java.lang.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 java.lang.String getName()
Specified by:
getName in interface Cache

getSize

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


Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.