org.datanucleus.cache.swarmcache
Class SwarmCacheLevel2Cache

java.lang.Object
  extended by org.datanucleus.cache.swarmcache.SwarmCacheLevel2Cache
All Implemented Interfaces:
java.io.Serializable, org.datanucleus.cache.Level2Cache

public class SwarmCacheLevel2Cache
extends java.lang.Object
implements org.datanucleus.cache.Level2Cache

Simple implementation of a plugin for use of SwarmCache caching product with DataNucleus. Please refer to SwarmCache for full details of their product.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.datanucleus.cache.Level2Cache
org.datanucleus.cache.Level2Cache.PinnedClass
 
Constructor Summary
SwarmCacheLevel2Cache(org.datanucleus.OMFContext omfCtx)
          Constructor.
 
Method Summary
 void clear()
          Method to clear the cache
 void close()
          Method to close the cache when no longer needed.
 boolean containsOid(java.lang.Object oid)
          Accessor for whether the cache contains the specified id.
 void evict(java.lang.Object oid)
          Evict the parameter instance from the second-level cache.
 void evictAll()
          Evict the parameter instances from the second-level cache.
 void evictAll(java.lang.Class pcClass, boolean subclasses)
          Evict the parameter instances from the second-level cache.
 void evictAll(java.util.Collection oids)
          Evict the parameter instances from the second-level cache.
 void evictAll(java.lang.Object[] oids)
          Evict the parameter instances from the second-level cache.
 org.datanucleus.cache.CachedPC get(java.lang.Object oid)
          Accessor for an object in the cache.
 int getNumberOfPinnedObjects()
          Accessor for the number of pinned objects - not supported by Ehcache.
 int getNumberOfUnpinnedObjects()
          Accessor for the number of unpinned objects - not supported by Ehcache.
 int getSize()
          Accessor for the size of the cache.
 boolean isEmpty()
          Accessor for whether the cache is empty
 void pin(java.lang.Object oid)
          Pin the parameter instance in the second-level cache.
 void pinAll(java.lang.Class pcClass, boolean subclasses)
          Pin instances in the second-level cache.
 void pinAll(java.util.Collection oids)
          Pin the parameter instances in the second-level cache.
 void pinAll(java.lang.Object[] oids)
          Pin the parameter instances in the second-level cache.
 org.datanucleus.cache.CachedPC put(java.lang.Object oid, org.datanucleus.cache.CachedPC pc)
          Method to add an object to the cache under its id
 void unpin(java.lang.Object oid)
          Unpin the parameter instance from the second-level cache.
 void unpinAll(java.lang.Class pcClass, boolean subclasses)
          Unpin instances from the second-level cache.
 void unpinAll(java.util.Collection oids)
          Unpin the parameter instances from the second-level cache.
 void unpinAll(java.lang.Object[] oids)
          Unpin the parameter instances from the second-level cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwarmCacheLevel2Cache

public SwarmCacheLevel2Cache(org.datanucleus.OMFContext omfCtx)
Constructor.

Parameters:
omfCtx - OMF Context
Method Detail

close

public void close()
Method to close the cache when no longer needed. Provides a hook to release resources etc.

Specified by:
close in interface org.datanucleus.cache.Level2Cache

clear

public void clear()
Method to clear the cache

Specified by:
clear in interface org.datanucleus.cache.Level2Cache
See Also:
Level2Cache.clear()

containsOid

public boolean containsOid(java.lang.Object oid)
Accessor for whether the cache contains the specified id.

Specified by:
containsOid in interface org.datanucleus.cache.Level2Cache
See Also:
Level2Cache.containsOid(java.lang.Object)

get

public org.datanucleus.cache.CachedPC get(java.lang.Object oid)
Accessor for an object in the cache.

Specified by:
get in interface org.datanucleus.cache.Level2Cache
See Also:
Level2Cache.get(java.lang.Object)

getNumberOfPinnedObjects

public int getNumberOfPinnedObjects()
Accessor for the number of pinned objects - not supported by Ehcache.

Specified by:
getNumberOfPinnedObjects in interface org.datanucleus.cache.Level2Cache
See Also:
Level2Cache.getNumberOfPinnedObjects()

getNumberOfUnpinnedObjects

public int getNumberOfUnpinnedObjects()
Accessor for the number of unpinned objects - not supported by Ehcache.

Specified by:
getNumberOfUnpinnedObjects in interface org.datanucleus.cache.Level2Cache
See Also:
Level2Cache.getNumberOfUnpinnedObjects()

getSize

public int getSize()
Accessor for the size of the cache.

Specified by:
getSize in interface org.datanucleus.cache.Level2Cache
See Also:
Level2Cache.getSize()

isEmpty

public boolean isEmpty()
Accessor for whether the cache is empty

Specified by:
isEmpty in interface org.datanucleus.cache.Level2Cache
See Also:
Level2Cache.isEmpty()

put

public org.datanucleus.cache.CachedPC put(java.lang.Object oid,
                                          org.datanucleus.cache.CachedPC pc)
Method to add an object to the cache under its id

Specified by:
put in interface org.datanucleus.cache.Level2Cache
Parameters:
oid - The identity
pc - The cacheable object

evict

public void evict(java.lang.Object oid)
Evict the parameter instance from the second-level cache.

Specified by:
evict in interface org.datanucleus.cache.Level2Cache
Parameters:
oid - the object id of the instance to evict.

evictAll

public void evictAll()
Evict the parameter instances from the second-level cache. All instances in the PersistenceManager's cache are evicted from the second-level cache.

Specified by:
evictAll in interface org.datanucleus.cache.Level2Cache

evictAll

public void evictAll(java.lang.Class pcClass,
                     boolean subclasses)
Evict the parameter instances from the second-level cache.

Specified by:
evictAll in interface org.datanucleus.cache.Level2Cache
Parameters:
pcClass - the class of instances to evict
subclasses - if true, evict instances of subclasses also

evictAll

public void evictAll(java.util.Collection oids)
Evict the parameter instances from the second-level cache.

Specified by:
evictAll in interface org.datanucleus.cache.Level2Cache
Parameters:
oids - the object ids of the instance to evict.

evictAll

public void evictAll(java.lang.Object[] oids)
Evict the parameter instances from the second-level cache.

Specified by:
evictAll in interface org.datanucleus.cache.Level2Cache
Parameters:
oids - the object ids of the instance to evict.

pin

public void pin(java.lang.Object oid)
Pin the parameter instance in the second-level cache.

Specified by:
pin in interface org.datanucleus.cache.Level2Cache
Parameters:
oid - the object id of the instance to pin.

pinAll

public void pinAll(java.lang.Class pcClass,
                   boolean subclasses)
Pin instances in the second-level cache.

Specified by:
pinAll in interface org.datanucleus.cache.Level2Cache
Parameters:
pcClass - the class of instances to pin
subclasses - if true, pin instances of subclasses also

pinAll

public void pinAll(java.util.Collection oids)
Pin the parameter instances in the second-level cache.

Specified by:
pinAll in interface org.datanucleus.cache.Level2Cache
Parameters:
oids - the object ids of the instances to pin.

pinAll

public void pinAll(java.lang.Object[] oids)
Pin the parameter instances in the second-level cache.

Specified by:
pinAll in interface org.datanucleus.cache.Level2Cache
Parameters:
oids - the object ids of the instances to pin.

unpin

public void unpin(java.lang.Object oid)
Unpin the parameter instance from the second-level cache.

Specified by:
unpin in interface org.datanucleus.cache.Level2Cache
Parameters:
oid - the object id of the instance to unpin.

unpinAll

public void unpinAll(java.lang.Class pcClass,
                     boolean subclasses)
Unpin instances from the second-level cache.

Specified by:
unpinAll in interface org.datanucleus.cache.Level2Cache
Parameters:
pcClass - the class of instances to unpin
subclasses - if true, unpin instances of subclasses also

unpinAll

public void unpinAll(java.util.Collection oids)
Unpin the parameter instances from the second-level cache.

Specified by:
unpinAll in interface org.datanucleus.cache.Level2Cache
Parameters:
oids - the object ids of the instance to evict.

unpinAll

public void unpinAll(java.lang.Object[] oids)
Unpin the parameter instances from the second-level cache.

Specified by:
unpinAll in interface org.datanucleus.cache.Level2Cache
Parameters:
oids - the object ids of the instance to evict.


Copyright © 2010. All Rights Reserved.