Class CoherenceIndexedSessionRepository
- java.lang.Object
-
- com.oracle.coherence.spring.session.CoherenceIndexedSessionRepository
-
- All Implemented Interfaces:
Aware
,ApplicationEventPublisherAware
,org.springframework.session.FindByIndexNameSessionRepository<com.oracle.coherence.spring.session.CoherenceSpringSession>
,org.springframework.session.SessionRepository<com.oracle.coherence.spring.session.CoherenceSpringSession>
public class CoherenceIndexedSessionRepository extends Object implements org.springframework.session.FindByIndexNameSessionRepository<com.oracle.coherence.spring.session.CoherenceSpringSession>, ApplicationEventPublisherAware
TheCoherenceIndexedSessionRepository
is aSessionRepository
implementation that stores sessions in Coherence's distributedCacheMap
.- Since:
- 3.0
- Author:
- Gunnar Hillert
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_SESSION_MAP_NAME
The default name of map used by Spring Session to store sessions.static String
PRINCIPAL_NAME_ATTRIBUTE
The principal name custom attribute name.
-
Constructor Summary
Constructors Constructor Description CoherenceIndexedSessionRepository(com.tangosol.net.Session coherenceSession)
Create a newCoherenceIndexedSessionRepository
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
com.oracle.coherence.spring.session.CoherenceSpringSession
createSession()
void
deleteById(String id)
com.oracle.coherence.spring.session.CoherenceSpringSession
findById(String id)
Map<String,com.oracle.coherence.spring.session.CoherenceSpringSession>
findByIndexNameAndIndexValue(String indexName, String indexValue)
org.springframework.session.FlushMode
getFlushMode()
org.springframework.session.IndexResolver<org.springframework.session.Session>
getIndexResolver()
org.springframework.session.SaveMode
getSaveMode()
void
init()
void
save(com.oracle.coherence.spring.session.CoherenceSpringSession session)
void
setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
Sets theApplicationEventPublisher
that is used to publishsession events
.void
setDefaultMaxInactiveInterval(Duration defaultMaxInactiveInterval)
Set the maximum inactive interval between requests before newly created sessions will be invalidated.void
setFlushMode(org.springframework.session.FlushMode flushMode)
Sets theFlushMode
.void
setIndexResolver(org.springframework.session.IndexResolver<org.springframework.session.Session> indexResolver)
Set theIndexResolver
to use.void
setSaveMode(org.springframework.session.SaveMode saveMode)
Set the save mode.void
setSessionMapName(String sessionMapName)
Set the name of map used to store sessions.
-
-
-
Field Detail
-
DEFAULT_SESSION_MAP_NAME
public static final String DEFAULT_SESSION_MAP_NAME
The default name of map used by Spring Session to store sessions.- See Also:
- Constant Field Values
-
PRINCIPAL_NAME_ATTRIBUTE
public static final String PRINCIPAL_NAME_ATTRIBUTE
The principal name custom attribute name.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CoherenceIndexedSessionRepository
public CoherenceIndexedSessionRepository(com.tangosol.net.Session coherenceSession)
Create a newCoherenceIndexedSessionRepository
instance.- Parameters:
coherenceSession
- the CoherenceSession
instance to use for managing sessions
-
-
Method Detail
-
init
@PostConstruct public void init()
-
close
@PreDestroy public void close()
-
setDefaultMaxInactiveInterval
public void setDefaultMaxInactiveInterval(Duration defaultMaxInactiveInterval)
Set the maximum inactive interval between requests before newly created sessions will be invalidated. A value of0
means that the session will never time out unless the cache is configured otherwise in thecoherence-cache-config.xml
. The default is 1800s (30 minutes).- Parameters:
defaultMaxInactiveInterval
- the maximum inactive interval in seconds must not be negative or null
-
setIndexResolver
public void setIndexResolver(org.springframework.session.IndexResolver<org.springframework.session.Session> indexResolver)
Set theIndexResolver
to use.- Parameters:
indexResolver
- the index resolver
-
setSessionMapName
public void setSessionMapName(String sessionMapName)
Set the name of map used to store sessions.- Parameters:
sessionMapName
- the session map name
-
setFlushMode
public void setFlushMode(org.springframework.session.FlushMode flushMode)
Sets theFlushMode
. Defaults toFlushMode.ON_SAVE
.- Parameters:
flushMode
- must not be null
-
setSaveMode
public void setSaveMode(org.springframework.session.SaveMode saveMode)
Set the save mode.- Parameters:
saveMode
- must not be null
-
createSession
public com.oracle.coherence.spring.session.CoherenceSpringSession createSession()
- Specified by:
createSession
in interfaceorg.springframework.session.SessionRepository<com.oracle.coherence.spring.session.CoherenceSpringSession>
-
save
public void save(com.oracle.coherence.spring.session.CoherenceSpringSession session)
- Specified by:
save
in interfaceorg.springframework.session.SessionRepository<com.oracle.coherence.spring.session.CoherenceSpringSession>
-
findById
public com.oracle.coherence.spring.session.CoherenceSpringSession findById(String id)
- Specified by:
findById
in interfaceorg.springframework.session.SessionRepository<com.oracle.coherence.spring.session.CoherenceSpringSession>
-
deleteById
public void deleteById(String id)
- Specified by:
deleteById
in interfaceorg.springframework.session.SessionRepository<com.oracle.coherence.spring.session.CoherenceSpringSession>
-
findByIndexNameAndIndexValue
public Map<String,com.oracle.coherence.spring.session.CoherenceSpringSession> findByIndexNameAndIndexValue(String indexName, String indexValue)
- Specified by:
findByIndexNameAndIndexValue
in interfaceorg.springframework.session.FindByIndexNameSessionRepository<com.oracle.coherence.spring.session.CoherenceSpringSession>
-
getFlushMode
public org.springframework.session.FlushMode getFlushMode()
-
getSaveMode
public org.springframework.session.SaveMode getSaveMode()
-
getIndexResolver
public org.springframework.session.IndexResolver<org.springframework.session.Session> getIndexResolver()
-
setApplicationEventPublisher
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
Sets theApplicationEventPublisher
that is used to publishsession events
. The default is to not publish session events.- Specified by:
setApplicationEventPublisher
in interfaceApplicationEventPublisherAware
- Parameters:
applicationEventPublisher
- theApplicationEventPublisher
that is used to publish session events. Cannot be null.
-
-