Class FixedDurationExpirationSessionRepository<S extends org.springframework.session.Session>
java.lang.Object
org.springframework.session.data.gemfire.expiration.repository.FixedDurationExpirationSessionRepository<S>
- All Implemented Interfaces:
org.springframework.session.SessionRepository<S>
public class FixedDurationExpirationSessionRepository<S extends org.springframework.session.Session>
extends Object
implements org.springframework.session.SessionRepository<S>
The
FixedDurationExpirationSessionRepository
class is a SessionRepository
implementation wrapping
an existing SessionRepository
, data store specific, implementation in order to implement
a fixed Duration
expiration policy on the Session
.
That is, the Session
will always expire (or be considered "expired") after a fixed amount of time. Even if
the user Session
is still actively being accessed up to the last moment right before the Session
is about to expire, the Session
will expire regardless.
This may be useful in certain UCs where, for security reasons, the Session
must expire no matter what.- Since:
- 2.1.0
- See Also:
-
Duration
Instant
Session
SessionRepository
- Absolute Session Timeouts
-
Constructor Summary
ConstructorsConstructorDescriptionFixedDurationExpirationSessionRepository
(org.springframework.session.SessionRepository<S> sessionRepository, Duration expirationTimeout) Constructs a new instance ofFixedDurationExpirationSessionRepository
initialized with the given data store specificSessionRepository
. -
Method Summary
Modifier and TypeMethodDescriptionCreates a new instance ofSession
.void
deleteById
(String id) Deletes theSession
identified by the givenID
.Finds aSession
with the givenID
.protected org.springframework.session.SessionRepository<S>
Returns a reference to the data store specificSessionRepository
.Return anOptional
expiraiton timeout
.void
Saves the givenSession
to the underlying data (persistent) store.
-
Constructor Details
-
FixedDurationExpirationSessionRepository
public FixedDurationExpirationSessionRepository(@NonNull org.springframework.session.SessionRepository<S> sessionRepository, @Nullable Duration expirationTimeout) Constructs a new instance ofFixedDurationExpirationSessionRepository
initialized with the given data store specificSessionRepository
.- Parameters:
sessionRepository
-SessionRepository
delegate.expirationTimeout
-Duration
specifying the length of time until theSession
expires.- Throws:
IllegalArgumentException
- ifSessionRepository
is null.- See Also:
-
SessionRepository
Duration
-
-
Method Details
-
getDelegate
Returns a reference to the data store specificSessionRepository
.- Returns:
- a reference to the data store specific
SessionRepository
. - See Also:
-
SessionRepository
-
getExpirationTimeout
Return anOptional
expiraiton timeout
.- Returns:
- an
Optional
expiraiton timeout
. - See Also:
-
createSession
Creates a new instance ofSession
. TheSession
instance will be managed by Apache Geode or Pivotal GemFire.- Specified by:
createSession
in interfaceorg.springframework.session.SessionRepository<S extends org.springframework.session.Session>
- Returns:
- a new instance of
Session
. - See Also:
-
Session
-
findById
Finds aSession
with the givenID
. This method will also perform a lazy expiration check to determine if theSession
has already expired upon access, and if so, delete theSession
with the givenID
.- Specified by:
findById
in interfaceorg.springframework.session.SessionRepository<S extends org.springframework.session.Session>
- Parameters:
id
-String
containing the ID identifying theSession
to lookup.- Returns:
- the
Session
with the givenID
or null if noSession
withID
exists or theSession
is expired. - See Also:
-
Session
handleExpired(Session, Duration)
getExpirationTimeout()
-
save
Saves the givenSession
to the underlying data (persistent) store.- Specified by:
save
in interfaceorg.springframework.session.SessionRepository<S extends org.springframework.session.Session>
- Parameters:
session
-Session
to save.- See Also:
-
Session
-
deleteById
Deletes theSession
identified by the givenID
.
-