org.springframework.datastore.redis
Class RedisSession

java.lang.Object
  extended by org.springframework.datastore.core.AbstractSession
      extended by org.springframework.datastore.redis.RedisSession
All Implemented Interfaces:
Session, SessionImplementor, EntityInterceptorAware

public class RedisSession
extends AbstractSession

Since:
1.0

Field Summary
 
Fields inherited from class org.springframework.datastore.core.AbstractSession
attributes, firstLevelCache, interceptors, lockedObjects, objectToKey, pendingDeletes, pendingInserts, pendingUpdates, persisters
 
Constructor Summary
RedisSession(Datastore ds, MappingContext mappingContext, RedisTemplate template)
           
 
Method Summary
protected  Transaction beginTransactionInternal()
           
protected  Persister createPersister(Class cls, MappingContext mappingContext)
           
 void disconnect()
          Performs clear up.
 RedisTemplate getNativeInterface()
           
 boolean isConnected()
           
 Object lock(Class type, Serializable key)
          Retrieves an individual object, using a write lock to prevent loss of updates
 void lock(Object o)
          Obtains a write lock on the given object
 Object pop(Class type)
           
protected  void postFlush()
           
 Object random(Class type)
           
 void unlock(Object o)
          Releases a lock, if not called all locked objects should be released by Session.disconnect()
 
Methods inherited from class org.springframework.datastore.core.AbstractSession
addEntityInterceptor, attach, beginTransaction, cacheObject, clear, clear, contains, createQuery, delete, delete, flush, getAttribute, getDatastore, getFlushMode, getMappingContext, getPendingDeletes, getPendingInserts, getPendingUpdates, getPersister, getTransaction, persist, persist, proxy, refresh, retrieve, retrieveAll, retrieveAll, setAttribute, setEntityInterceptors, setFlushMode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RedisSession

public RedisSession(Datastore ds,
                    MappingContext mappingContext,
                    RedisTemplate template)
Method Detail

createPersister

protected Persister createPersister(Class cls,
                                    MappingContext mappingContext)
Specified by:
createPersister in class AbstractSession

isConnected

public boolean isConnected()
Returns:
true if connected to the datastore

disconnect

public void disconnect()
Description copied from class: AbstractSession
Performs clear up. Subclasses should always call into this super implementation.

Specified by:
disconnect in interface Session
Overrides:
disconnect in class AbstractSession

beginTransactionInternal

protected Transaction beginTransactionInternal()
Specified by:
beginTransactionInternal in class AbstractSession

lock

public void lock(Object o)
Description copied from interface: Session
Obtains a write lock on the given object

Specified by:
lock in interface Session
Overrides:
lock in class AbstractSession
Parameters:
o - The object to lock

unlock

public void unlock(Object o)
Description copied from interface: Session
Releases a lock, if not called all locked objects should be released by Session.disconnect()

Specified by:
unlock in interface Session
Overrides:
unlock in class AbstractSession
Parameters:
o - The object to unlock

lock

public Object lock(Class type,
                   Serializable key)
Description copied from interface: Session
Retrieves an individual object, using a write lock to prevent loss of updates

Specified by:
lock in interface Session
Overrides:
lock in class AbstractSession
Parameters:
type - The type
key - The key
Returns:
The object

random

public Object random(Class type)

postFlush

protected void postFlush()
Overrides:
postFlush in class AbstractSession

pop

public Object pop(Class type)

getNativeInterface

public RedisTemplate getNativeInterface()
Returns:
The native interface to the datastore