public class MongoIndexedSessionRepository extends Object implements org.springframework.session.FindByIndexNameSessionRepository<MongoSession>, ApplicationEventPublisherAware, InitializingBean
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 |
|---|
MongoIndexedSessionRepository(org.springframework.data.mongodb.core.MongoOperations mongoOperations) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
MongoSession |
createSession() |
void |
deleteById(String id) |
MongoSession |
findById(String id) |
Map<String,MongoSession> |
findByIndexNameAndIndexValue(String indexName,
String indexValue)
Currently this repository allows only querying against
PRINCIPAL_NAME_INDEX_NAME. |
void |
save(MongoSession session) |
void |
setApplicationEventPublisher(ApplicationEventPublisher eventPublisher) |
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 MongoIndexedSessionRepository(org.springframework.data.mongodb.core.MongoOperations mongoOperations)
public MongoSession createSession()
createSession in interface org.springframework.session.SessionRepository<MongoSession>public void save(MongoSession session)
save in interface org.springframework.session.SessionRepository<MongoSession>@Nullable public MongoSession findById(String id)
findById in interface org.springframework.session.SessionRepository<MongoSession>public Map<String,MongoSession> findByIndexNameAndIndexValue(String indexName, String indexValue)
PRINCIPAL_NAME_INDEX_NAME.findByIndexNameAndIndexValue in interface org.springframework.session.FindByIndexNameSessionRepository<MongoSession>indexName - the name if the index (i.e. FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME)indexValue - the value of the index to search for.public void deleteById(String id)
deleteById in interface org.springframework.session.SessionRepository<MongoSession>public void afterPropertiesSet()
afterPropertiesSet in interface InitializingBeanpublic void setApplicationEventPublisher(ApplicationEventPublisher eventPublisher)
setApplicationEventPublisher in interface ApplicationEventPublisherAwarepublic void setMaxInactiveIntervalInSeconds(Integer maxInactiveIntervalInSeconds)
public void setCollectionName(String collectionName)
public void setMongoSessionConverter(AbstractMongoSessionConverter mongoSessionConverter)
Copyright © 2014-2019–2020 Pivotal, Inc.. All rights reserved.