org.datanucleus.cache
Interface Level2Cache

All Known Implementing Classes:
DefaultLevel2Cache, NullLevel2Cache, SoftLevel2Cache

public interface Level2Cache

Interface for any Level 2 Cache used internally. Provides the typical controls required internally and including the JDO2/JPA1 L2 cache methods.


Nested Class Summary
static class Level2Cache.PinnedClass
          Representation of a class whose objects will be pinned when put into the L2 cache.
 
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)
          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.
 CachedPC put(java.lang.Object oid, CachedPC pc)
          Method to put an object in the 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 instance from the second-level cache.
 

Method Detail

close

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


evict

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

Parameters:
oid - the object id of the instance to evict.

evictAll

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.


evictAll

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

Parameters:
oids - the object ids of the instance to evict.

evictAll

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

Parameters:
oids - the object ids of the instance to evict.

evictAll

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

Parameters:
pcClass - the class of instances to evict
subclasses - if true, evict instances of subclasses also

pin

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

Parameters:
oid - the object id of the instance to pin.

pinAll

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

Parameters:
oids - the object ids of the instances to pin.

pinAll

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

Parameters:
oids - the object ids of the instances to pin.

pinAll

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

Parameters:
pcClass - the class of instances to pin
subclasses - if true, pin instances of subclasses also

unpin

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

Parameters:
oid - the object id of the instance to unpin.

unpinAll

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

Parameters:
oids - the object ids of the instance to evict.

unpinAll

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

Parameters:
oids - the object id of the instance to evict.

unpinAll

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

Parameters:
pcClass - the class of instances to unpin
subclasses - if true, unpin instances of subclasses also

getNumberOfPinnedObjects

int getNumberOfPinnedObjects()
Accessor for the number of pinned objects in the cache.

Returns:
Number of pinned objects

getNumberOfUnpinnedObjects

int getNumberOfUnpinnedObjects()
Accessor for the number of unpinned objects in the cache.

Returns:
Number of unpinned objects

getSize

int getSize()
Accessor for the total number of objects in the L2 cache.

Returns:
Number of objects

get

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

Parameters:
oid - The Object ID
Returns:
The L2 cacheable object

put

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

Parameters:
oid - The Object id for this object
pc - The L2 cacheable PersistenceCapable object
Returns:
The value previously associated with this oid

isEmpty

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

Returns:
Whether it is empty.

clear

void clear()
Method to clear the cache.


containsOid

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

Parameters:
oid - The object id
Returns:
Whether it is in the cache


Copyright © 2009. All Rights Reserved.