com.xpn.xwiki.cache.impl
Class OSCacheCache

java.lang.Object
  extended by com.xpn.xwiki.cache.impl.OSCacheCache
All Implemented Interfaces:
XWikiCache

public class OSCacheCache
extends java.lang.Object
implements XWikiCache

Copyright 2006, XpertNet SARL, and individual contributors as indicated by the contributors.txt. This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this software; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org. Implements XWikiCache using oscache

Author:
ludovic, sdumitriu, markj, wr0ngway

Field Summary
private  com.opensymphony.oscache.general.GeneralCacheAdministrator cache
           
private  int capacity
           
private static org.apache.commons.logging.Log log
           
private  java.lang.String name
           
 
Constructor Summary
OSCacheCache(java.util.Properties props)
           
OSCacheCache(java.util.Properties props, int capacity)
           
 
Method Summary
 void cancelUpdate(java.lang.String key)
           
 void flushAll()
           
 void flushEntry(java.lang.String key)
           
(package private)  com.opensymphony.oscache.base.Cache getCache()
          Provide package-private access to the underlying m_cache
 int getCapacity()
           
 java.lang.Object getFromCache(java.lang.String key)
           
 java.lang.Object getFromCache(java.lang.String key, int refeshPeriod)
           
 java.lang.String getName()
           
 int getNumberEntries()
          Method called here is labeled "for test only" in OSCache JavaDoc, so don't call this a lot!
private  void logCacheAdd(java.lang.String sKey, java.lang.Object obj)
           
 void putInCache(java.lang.String key, java.lang.Object obj)
           
 void putInCache(java.lang.String key, java.lang.Object obj, com.opensymphony.oscache.base.EntryRefreshPolicy expiry)
           
 void setCapacity(int capacity)
           
 void setName(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

cache

private com.opensymphony.oscache.general.GeneralCacheAdministrator cache

name

private java.lang.String name

capacity

private int capacity
Constructor Detail

OSCacheCache

public OSCacheCache(java.util.Properties props)

OSCacheCache

public OSCacheCache(java.util.Properties props,
                    int capacity)
Method Detail

getCache

com.opensymphony.oscache.base.Cache getCache()
Provide package-private access to the underlying m_cache


setCapacity

public void setCapacity(int capacity)
Specified by:
setCapacity in interface XWikiCache

flushEntry

public void flushEntry(java.lang.String key)
Specified by:
flushEntry in interface XWikiCache

putInCache

public void putInCache(java.lang.String key,
                       java.lang.Object obj)
Specified by:
putInCache in interface XWikiCache

putInCache

public void putInCache(java.lang.String key,
                       java.lang.Object obj,
                       com.opensymphony.oscache.base.EntryRefreshPolicy expiry)

getFromCache

public java.lang.Object getFromCache(java.lang.String key)
                              throws XWikiCacheNeedsRefreshException
Specified by:
getFromCache in interface XWikiCache
Throws:
XWikiCacheNeedsRefreshException

getFromCache

public java.lang.Object getFromCache(java.lang.String key,
                                     int refeshPeriod)
                              throws XWikiCacheNeedsRefreshException
Specified by:
getFromCache in interface XWikiCache
Throws:
XWikiCacheNeedsRefreshException

cancelUpdate

public void cancelUpdate(java.lang.String key)
Specified by:
cancelUpdate in interface XWikiCache

flushAll

public void flushAll()
Specified by:
flushAll in interface XWikiCache

getNumberEntries

public int getNumberEntries()
Method called here is labeled "for test only" in OSCache JavaDoc, so don't call this a lot!


setName

public void setName(java.lang.String name)

getName

public java.lang.String getName()

getCapacity

public int getCapacity()

logCacheAdd

private void logCacheAdd(java.lang.String sKey,
                         java.lang.Object obj)


Copyright 2003 Ludovic Dubost