org.datanucleus.cache
Class NullLevel2Cache

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

public class NullLevel2Cache
extends java.lang.Object
implements Level2Cache

Null implementation of a Level 2 Cache. Does nothing when its methods are invoked.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.datanucleus.cache.Level2Cache
Level2Cache.PinnedClass
 
Constructor Summary
NullLevel2Cache(OMFContext omfCtx)
           
 
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 an object with the specified id is in the cache
 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.
 CachedPC get(java.lang.Object oid)
          Accessor for an object from the cache
 int getNumberOfPinnedObjects()
          Accessor for the number of pinned objects in the cache.
 int getNumberOfUnpinnedObjects()
          Accessor for the number of unpinned objects in the cache.
 int getSize()
          Accessor for the total number of objects in the L2 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)
          Evict the parameter instances from 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.
 CachedPC put(java.lang.Object oid, CachedPC pc)
          Method to put an object in the L2 cache
 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

NullLevel2Cache

public NullLevel2Cache(OMFContext omfCtx)
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 Level2Cache

evict

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

Specified by:
evict in interface 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 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 Level2Cache
Parameters:
pcClass - the class to evict
subclasses - Whether to evict all subclasses of this class also

evictAll

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

Specified by:
evictAll in interface 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 Level2Cache
Parameters:
oids - the object ids of the instances to evict

pin

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

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

pinAll

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

Specified by:
pinAll in interface Level2Cache
Parameters:
pcClass - the class of instances to evict
subclasses - if true, evict 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 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 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 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 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 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 Level2Cache
Parameters:
oids - the object ids of the instance to evict.

clear

public void clear()
Method to clear the cache.

Specified by:
clear in interface Level2Cache

containsOid

public boolean containsOid(java.lang.Object oid)
Accessor for whether an object with the specified id is in the cache

Specified by:
containsOid in interface Level2Cache
Parameters:
oid - The object id
Returns:
Whether it is in the cache

get

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

Specified by:
get in interface Level2Cache
Parameters:
oid - The identity
Returns:
The cacheable object

getNumberOfPinnedObjects

public int getNumberOfPinnedObjects()
Description copied from interface: Level2Cache
Accessor for the number of pinned objects in the cache.

Specified by:
getNumberOfPinnedObjects in interface Level2Cache
Returns:
Number of pinned objects
See Also:
Level2Cache.getNumberOfPinnedObjects()

getNumberOfUnpinnedObjects

public int getNumberOfUnpinnedObjects()
Description copied from interface: Level2Cache
Accessor for the number of unpinned objects in the cache.

Specified by:
getNumberOfUnpinnedObjects in interface Level2Cache
Returns:
Number of unpinned objects
See Also:
Level2Cache.getNumberOfUnpinnedObjects()

getSize

public int getSize()
Description copied from interface: Level2Cache
Accessor for the total number of objects in the L2 cache.

Specified by:
getSize in interface Level2Cache
Returns:
Number of objects
See Also:
Level2Cache.getSize()

isEmpty

public boolean isEmpty()
Description copied from interface: Level2Cache
Accessor for whether the cache is empty.

Specified by:
isEmpty in interface Level2Cache
Returns:
Whether it is empty.
See Also:
Level2Cache.isEmpty()

put

public CachedPC put(java.lang.Object oid,
                    CachedPC pc)
Method to put an object in the L2 cache

Specified by:
put in interface Level2Cache
Parameters:
oid - The identity
pc - Cacheable form of the PC
Returns:
Previous value stored for this id


Copyright © 2011. All Rights Reserved.