org.apache.jcs.auxiliary
Class MockAuxiliaryCache<K extends Serializable,V extends Serializable>

java.lang.Object
  extended by org.apache.jcs.auxiliary.AbstractAuxiliaryCache<K,V>
      extended by org.apache.jcs.auxiliary.MockAuxiliaryCache<K,V>
All Implemented Interfaces:
AuxiliaryCache<K,V>, ICache<K,V>, ICacheType

public class MockAuxiliaryCache<K extends Serializable,V extends Serializable>
extends AbstractAuxiliaryCache<K,V>

Mock auxiliary for unit tests.

Author:
Aaron Smuts

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.jcs.engine.behavior.ICacheType
ICacheType.CacheType
 
Field Summary
 ICacheType.CacheType cacheType
          Can setup the cache type
 int getMatchingCallCount
          Times getMatching was Called
 CacheStatus status
          Can setup status
 
Fields inherited from class org.apache.jcs.auxiliary.AbstractAuxiliaryCache
cacheEventLogger, elementSerializer, keyMatcher
 
Constructor Summary
MockAuxiliaryCache()
           
 
Method Summary
 void dispose()
           
 ICacheElement<K,V> get(K key)
           
 AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
           
 String getCacheName()
           
 ICacheType.CacheType getCacheType()
           
 String getEventLoggingExtraInfo()
           
 Set<K> getGroupKeys(String group)
           
 Set<String> getGroupNames()
           
 Map<K,ICacheElement<K,V>> getMatching(String pattern)
           
 Map<K,ICacheElement<K,V>> getMultiple(Set<K> keys)
          Gets multiple items from the cache based on the given set of keys.
 int getSize()
           
 IStats getStatistics()
           
 String getStats()
           
 CacheStatus getStatus()
           
 boolean remove(K key)
           
 void removeAll()
           
 void update(ICacheElement<K,V> ce)
           
 
Methods inherited from class org.apache.jcs.auxiliary.AbstractAuxiliaryCache
createICacheEvent, createICacheEvent, getCacheEventLogger, getElementSerializer, getKeyMatcher, logApplicationEvent, logError, logICacheEvent, setCacheEventLogger, setElementSerializer, setKeyMatcher
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cacheType

public ICacheType.CacheType cacheType
Can setup the cache type


status

public CacheStatus status
Can setup status


getMatchingCallCount

public int getMatchingCallCount
Times getMatching was Called

Constructor Detail

MockAuxiliaryCache

public MockAuxiliaryCache()
Method Detail

update

public void update(ICacheElement<K,V> ce)
            throws IOException
Parameters:
ce -
Throws:
IOException

get

public ICacheElement<K,V> get(K key)
                                                                 throws IOException
Parameters:
key -
Returns:
ICacheElement
Throws:
IOException

getMatching

public Map<K,ICacheElement<K,V>> getMatching(String pattern)
                                                                                                     throws IOException
Parameters:
pattern -
Returns:
Map
Throws:
IOException

getMultiple

public Map<K,ICacheElement<K,V>> getMultiple(Set<K> keys)
Gets multiple items from the cache based on the given set of keys.

Parameters:
keys -
Returns:
a map of K key to ICacheElement element, or an empty map if there is no data in cache for any of these keys

remove

public boolean remove(K key)
               throws IOException
Parameters:
key -
Returns:
boolean
Throws:
IOException

removeAll

public void removeAll()
               throws IOException
Throws:
IOException

dispose

public void dispose()
             throws IOException
Throws:
IOException

getSize

public int getSize()
Returns:
int

getStatus

public CacheStatus getStatus()
Returns:
int

getCacheName

public String getCacheName()
Returns:
null

getGroupKeys

public Set<K> getGroupKeys(String group)
                                         throws IOException
Parameters:
group -
Returns:
null
Throws:
IOException

getGroupNames

public Set<String> getGroupNames()
                          throws IOException
Returns:
null
Throws:
IOException

getStatistics

public IStats getStatistics()
Returns:
null

getStats

public String getStats()
Returns:
null

getCacheType

public ICacheType.CacheType getCacheType()
Returns:
cacheType

getAuxiliaryCacheAttributes

public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
Returns:
Returns the AuxiliaryCacheAttributes.

getEventLoggingExtraInfo

public String getEventLoggingExtraInfo()
Specified by:
getEventLoggingExtraInfo in class AbstractAuxiliaryCache<K extends Serializable,V extends Serializable>
Returns:
null


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