public class MongoOperationsSessionRepository extends Object implements org.springframework.session.FindByIndexNameSessionRepository<MongoExpiringSession>
AbstractMongoSessionConverter to transform session objects from/to native Mongo
representation (DBObject).
Repository is also responsible for removing expired sessions from database. Cleanup is
done every minute.| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_COLLECTION_NAME
the default collection name for storing session.
|
static int |
DEFAULT_INACTIVE_INTERVAL
The default time period in seconds in which a session will expire.
|
| Constructor and Description |
|---|
MongoOperationsSessionRepository(org.springframework.data.mongodb.core.MongoOperations mongoOperations) |
| Modifier and Type | Method and Description |
|---|---|
MongoExpiringSession |
createSession() |
void |
delete(String id) |
void |
ensureIndexesAreCreated() |
Map<String,MongoExpiringSession> |
findByIndexNameAndIndexValue(String indexName,
String indexValue)
Currently this repository allows only querying against
PRINCIPAL_NAME_INDEX_NAME. |
MongoExpiringSession |
getSession(String id) |
void |
save(MongoExpiringSession session) |
void |
setCollectionName(String collectionName) |
void |
setMaxInactiveIntervalInSeconds(Integer maxInactiveIntervalInSeconds) |
void |
setMongoSessionConverter(AbstractMongoSessionConverter mongoSessionConverter) |
public static final int DEFAULT_INACTIVE_INTERVAL
public static final String DEFAULT_COLLECTION_NAME
public MongoOperationsSessionRepository(org.springframework.data.mongodb.core.MongoOperations mongoOperations)
public MongoExpiringSession createSession()
createSession in interface org.springframework.session.SessionRepository<MongoExpiringSession>public void save(MongoExpiringSession session)
save in interface org.springframework.session.SessionRepository<MongoExpiringSession>public MongoExpiringSession getSession(String id)
getSession in interface org.springframework.session.SessionRepository<MongoExpiringSession>public Map<String,MongoExpiringSession> findByIndexNameAndIndexValue(String indexName, String indexValue)
PRINCIPAL_NAME_INDEX_NAME.findByIndexNameAndIndexValue in interface org.springframework.session.FindByIndexNameSessionRepository<MongoExpiringSession>indexName - the name if the index (i.e.
FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME)indexValue - the value of the index to search for.public void delete(String id)
delete in interface org.springframework.session.SessionRepository<MongoExpiringSession>@PostConstruct public void ensureIndexesAreCreated()
public void setMongoSessionConverter(AbstractMongoSessionConverter mongoSessionConverter)
public void setMaxInactiveIntervalInSeconds(Integer maxInactiveIntervalInSeconds)
public void setCollectionName(String collectionName)
Copyright © 2014-2017–2017 Pivotal, Inc.. All rights reserved.