org.apache.jcs.auxiliary.disk.jdbc.mysql
Class MySQLDiskCache<K extends Serializable,V extends Serializable>

java.lang.Object
  extended by org.apache.jcs.auxiliary.AbstractAuxiliaryCache<K,V>
      extended by org.apache.jcs.auxiliary.AbstractAuxiliaryCacheEventLogging<K,V>
          extended by org.apache.jcs.auxiliary.disk.AbstractDiskCache<K,V>
              extended by org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCache<K,V>
                  extended by org.apache.jcs.auxiliary.disk.jdbc.mysql.MySQLDiskCache<K,V>
All Implemented Interfaces:
AuxiliaryCache<K,V>, ICache<K,V>, ICacheType

public class MySQLDiskCache<K extends Serializable,V extends Serializable>
extends JDBCDiskCache<K,V>

The MySQLDiskCache extends the core JDBCDiskCache.

Although the generic JDBC Disk Cache can be used for MySQL, the MySQL JDBC Disk Cache has additional features, such as table optimization that are particular to MySQL.

Author:
Aaron Smuts

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.jcs.auxiliary.disk.AbstractDiskCache
AbstractDiskCache.MyCacheListener
 
Nested classes/interfaces inherited from interface org.apache.jcs.engine.behavior.ICacheType
ICacheType.CacheType
 
Field Summary
 
Fields inherited from class org.apache.jcs.auxiliary.disk.AbstractDiskCache
alive, cacheEventQueue, cacheName, purgatory, purgHits, removeAllLock
 
Fields inherited from class org.apache.jcs.auxiliary.AbstractAuxiliaryCache
cacheEventLogger, keyMatcher
 
Constructor Summary
MySQLDiskCache(MySQLDiskCacheAttributes attributes, TableState tableState, ICompositeCacheManager compositeCacheManager)
          Delegates to the super and makes use of the MySQL specific parameters used for scheduled optimization.
 
Method Summary
 String constructLikeParameterFromPattern(String pattern)
           
protected  int deleteExpired()
          Removed the expired.
protected  ICacheElement<K,V> processGet(K key)
          This delegates to the generic JDBC disk cache.
protected  Map<K,ICacheElement<K,V>> processGetMatching(String pattern)
          This delegates to the generic JDBC disk cache.
protected  void processUpdate(ICacheElement<K,V> element)
          This delegates to the generic JDBC disk cache.
 
Methods inherited from class org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCache
doesElementExist, getAuxiliaryCacheAttributes, getDiskLocation, getElementSerializer, getGroupKeys, getGroupNames, getJdbcDiskCacheAttributes, getPoolAccess, getSize, getStatistics, getTableName, getTableState, initializePoolAccess, processDispose, processRemove, processRemoveAll, reset, setElementSerializer, setJdbcDiskCacheAttributes, setPoolAccess, setTableState, toString
 
Methods inherited from class org.apache.jcs.auxiliary.disk.AbstractDiskCache
dispose, doDispose, doGet, doGetMatching, doRemove, doRemoveAll, doUpdate, get, getCacheName, getCacheType, getEventLoggingExtraInfo, getMatching, getStats, getStatus, processGetMultiple, remove, removeAll, update
 
Methods inherited from class org.apache.jcs.auxiliary.AbstractAuxiliaryCacheEventLogging
disposeWithEventLogging, getMatchingWithEventLogging, getMultiple, getMultipleWithEventLogging, getWithEventLogging, removeAllWithEventLogging, removeWithEventLogging, updateWithEventLogging
 
Methods inherited from class org.apache.jcs.auxiliary.AbstractAuxiliaryCache
createICacheEvent, createICacheEvent, getCacheEventLogger, getKeyMatcher, logApplicationEvent, logError, logICacheEvent, setCacheEventLogger, setKeyMatcher
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.jcs.auxiliary.AuxiliaryCache
setCacheEventLogger
 
Methods inherited from interface org.apache.jcs.engine.behavior.ICache
getMultiple, setKeyMatcher
 

Constructor Detail

MySQLDiskCache

public MySQLDiskCache(MySQLDiskCacheAttributes attributes,
                      TableState tableState,
                      ICompositeCacheManager compositeCacheManager)
Delegates to the super and makes use of the MySQL specific parameters used for scheduled optimization.

Parameters:
attributes -
tableState -
compositeCacheManager -
Method Detail

processGet

protected ICacheElement<K,V> processGet(K key)
This delegates to the generic JDBC disk cache. If we are currently optimizing, then this method will balk and return null.

Overrides:
processGet in class JDBCDiskCache<K extends Serializable,V extends Serializable>
Parameters:
key - Key to locate value for.
Returns:
An object matching key, or null.
See Also:
AbstractDiskCache.doGet(java.io.Serializable)

processGetMatching

protected Map<K,ICacheElement<K,V>> processGetMatching(String pattern)
This delegates to the generic JDBC disk cache. If we are currently optimizing, then this method will balk and return null.

Overrides:
processGetMatching in class JDBCDiskCache<K extends Serializable,V extends Serializable>
Parameters:
pattern - used for like query.
Returns:
An object matching key, or null.

constructLikeParameterFromPattern

public String constructLikeParameterFromPattern(String pattern)
Overrides:
constructLikeParameterFromPattern in class JDBCDiskCache<K extends Serializable,V extends Serializable>
Parameters:
pattern -
Returns:
String to use in the like query.

processUpdate

protected void processUpdate(ICacheElement<K,V> element)
This delegates to the generic JDBC disk cache. If we are currently optimizing, then this method will balk and do nothing.

Overrides:
processUpdate in class JDBCDiskCache<K extends Serializable,V extends Serializable>
Parameters:
element -

deleteExpired

protected int deleteExpired()
Removed the expired. (now - create time) > max life seconds * 1000

If we are currently optimizing, then this method will balk and do nothing.

TODO consider blocking and trying again.

Overrides:
deleteExpired in class JDBCDiskCache<K extends Serializable,V extends Serializable>
Returns:
the number deleted


Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.