com.samskivert.jdbc.depot
Class SimpleCacheKey

java.lang.Object
  extended by com.samskivert.jdbc.depot.SimpleCacheKey
All Implemented Interfaces:
CacheKey

public class SimpleCacheKey
extends Object
implements CacheKey

Convenience class that implements CacheKey as simply as possibly. This class is typically used when the caller wants to cache a non-obvious query such as a collection, and needs to specify their own cache key and file it under a hand-picked cache id.


Field Summary
protected  String _cacheId
           
protected  Serializable _cacheKey
           
 
Constructor Summary
SimpleCacheKey(Class<?> cacheClass, Serializable cacheKey)
          Construct a SimpleCacheKey associated with the given persistent class with the given cache key.
SimpleCacheKey(String cacheId)
          Construct a SimpleCacheKey for a query that has no parameters whatsoever.
SimpleCacheKey(String cacheId, Serializable value)
          Construct a SimpleCacheKey for the given cache id with the given cache key.
 
Method Summary
 boolean equals(Object obj)
           
 String getCacheId()
          Returns the id of the cache in whose scope this key makes sense.
 Serializable getCacheKey()
          Returns the actual opaque serializable cache key under which results are stored in the cache identified by CacheKey.getCacheId().
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_cacheId

protected String _cacheId

_cacheKey

protected Serializable _cacheKey
Constructor Detail

SimpleCacheKey

public SimpleCacheKey(String cacheId)
Construct a SimpleCacheKey for a query that has no parameters whatsoever.


SimpleCacheKey

public SimpleCacheKey(Class<?> cacheClass,
                      Serializable cacheKey)
Construct a SimpleCacheKey associated with the given persistent class with the given cache key.


SimpleCacheKey

public SimpleCacheKey(String cacheId,
                      Serializable value)
Construct a SimpleCacheKey for the given cache id with the given cache key.

Method Detail

getCacheId

public String getCacheId()
Description copied from interface: CacheKey
Returns the id of the cache in whose scope this key makes sense.

Specified by:
getCacheId in interface CacheKey

getCacheKey

public Serializable getCacheKey()
Description copied from interface: CacheKey
Returns the actual opaque serializable cache key under which results are stored in the cache identified by CacheKey.getCacheId().

Specified by:
getCacheKey in interface CacheKey

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2000-2008 Michael Bayne. All Rights Reserved.