public class GemFireOperationsSessionRepository extends AbstractGemFireOperationsSessionRepository
GemFireOperationsSessionRepository class is a Spring SessionRepository implementation
that interfaces with and uses Apache Geode or Pivotal GemFire to back and store Spring Sessions.GemfireOperations,
Session,
SessionRepository,
AbstractGemFireOperationsSessionRepositoryAbstractGemFireOperationsSessionRepository.DeltaCapableGemFireSession, AbstractGemFireOperationsSessionRepository.DeltaCapableGemFireSessionAttributes, AbstractGemFireOperationsSessionRepository.GemFireSession<T extends AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes>, AbstractGemFireOperationsSessionRepository.GemFireSessionAttributes, AbstractGemFireOperationsSessionRepository.SessionEventHandlerCacheListenerAdapter, AbstractGemFireOperationsSessionRepository.SessionIdInterestRegisteringCacheListener| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
FIND_SESSIONS_BY_INDEX_NAME_AND_INDEX_VALUE_QUERY |
protected static java.lang.String |
FIND_SESSIONS_BY_PRINCIPAL_NAME_QUERY |
| Constructor and Description |
|---|
GemFireOperationsSessionRepository(org.springframework.data.gemfire.GemfireOperations template)
Constructs a new instance of
GemFireOperationsSessionRepository initialized with
the required GemfireOperations object used to perform data access operations
for managing (HTTP) Session state. |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.session.Session |
createSession()
Constructs a new
Session instance backed by GemFire. |
void |
deleteById(java.lang.String sessionId)
Deletes (removes) any existing
Session from GemFire. |
org.springframework.session.Session |
findById(java.lang.String sessionId)
Finds an existing, non-expired
Session by ID. |
java.util.Map<java.lang.String,org.springframework.session.Session> |
findByIndexNameAndIndexValue(java.lang.String indexName,
java.lang.String indexValue)
Finds all available
Sessions with the particular attribute indexed by name
having the given value. |
protected java.lang.String |
prepareQuery(java.lang.String indexName)
Prepares the appropriate Pivotal GemFire OQL query based on the indexed Session attribute
name.
|
void |
save(org.springframework.session.Session session)
Saves the specified
Session to Apache Geode or Pivotal GemFire. |
commit, configure, delete, getApplicationEventPublisher, getIsDirtyPredicate, getLogger, getMaxInactiveInterval, getMaxInactiveIntervalInSeconds, getSessionEventHandler, getSessionsRegion, getSessionsRegionName, getSessionsTemplate, getTemplate, handleDeleted, isRegisterInterestEnabled, isUsingDataSerialization, newSessionEventHandler, newSessionIdInterestRegistrar, publishEvent, registerInterest, registerInterest, resolvePool, setApplicationEventPublisher, setIsDirtyPredicate, setMaxInactiveInterval, setMaxInactiveIntervalInSeconds, setUseDataSerialization, touch, unregisterInterest, unregisterInterestprotected static final java.lang.String FIND_SESSIONS_BY_INDEX_NAME_AND_INDEX_VALUE_QUERY
protected static final java.lang.String FIND_SESSIONS_BY_PRINCIPAL_NAME_QUERY
public GemFireOperationsSessionRepository(org.springframework.data.gemfire.GemfireOperations template)
GemFireOperationsSessionRepository initialized with
the required GemfireOperations object used to perform data access operations
for managing (HTTP) Session state.template - GemfireOperations object used to access and manage Session state in GemFire.GemfireOperations@NonNull public org.springframework.session.Session createSession()
Session instance backed by GemFire.Session backed by GemFire.AbstractGemFireOperationsSessionRepository.GemFireSession.create(),
Session,
AbstractGemFireOperationsSessionRepository.configure(Session)@Nullable public org.springframework.session.Session findById(java.lang.String sessionId)
Session by ID.
If the Session is expired, then the Session is deleted and null is returned.sessionId - String containing the ID} of the Session to get.Session by ID or null if no Session exists
or the Session expired.AbstractGemFireOperationsSessionRepository.GemFireSession.from(Session),
GemfireTemplate.get(Object),
Session,
AbstractGemFireOperationsSessionRepository.getSessionsTemplate(),
prepare(Session),
AbstractGemFireOperationsSessionRepository.delete(Session)public java.util.Map<java.lang.String,org.springframework.session.Session> findByIndexNameAndIndexValue(java.lang.String indexName,
java.lang.String indexValue)
Sessions with the particular attribute indexed by name
having the given value.indexName - name of the indexed Session attribute.
(e.g. FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME).indexValue - value of the indexed Session attribute to search on
(e.g. username).Session.getId() Session IDs} to Session objects.GemfireTemplate.find(String, Object...),
Session,
Map,
AbstractGemFireOperationsSessionRepository.getSessionsTemplate(),
prepareQuery(String),
prepare(Session)protected java.lang.String prepareQuery(java.lang.String indexName)
indexName - a String indicating the name of the indexed Session attribute.AbstractGemFireOperationsSessionRepository.getSessionsRegionName()public void save(@Nullable
org.springframework.session.Session session)
Session to Apache Geode or Pivotal GemFire.
Warning, the save method should never be called asynchronously and concurrently, from a separate Thread,
while the caller continues to modify the given Session from the forking Thread
or data loss can occur! There is a reason why this method is blocking!session - the Session to save.GemfireOperations.put(Object, Object),
Session,
isNonNullAndDirty(Session),
doSave(Session)public void deleteById(java.lang.String sessionId)
Session from GemFire. This operation
also results in a SessionDeletedEvent.sessionId - a String indicating the ID of the Session to remove from GemFire.GemfireOperations.remove(Object),
AbstractGemFireOperationsSessionRepository.handleDeleted(String, Session)