Spring Session for VMware GemFire
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:
-
DurationInstantSessionSessionRepository- Absolute Session Timeouts
-
Constructor Summary
ConstructorsConstructorDescriptionFixedDurationExpirationSessionRepository(org.springframework.session.SessionRepository<S> sessionRepository, Duration expirationTimeout) Constructs a new instance ofFixedDurationExpirationSessionRepositoryinitialized with the given data store specificSessionRepository. -
Method Summary
Modifier and TypeMethodDescriptionCreates a new instance ofSession.voiddeleteById(String id) Deletes theSessionidentified by the givenID.Finds aSessionwith the givenID.protected org.springframework.session.SessionRepository<S>Returns a reference to the data store specificSessionRepository.Return anOptionalexpiraiton timeout.voidSaves the givenSessionto the underlying data (persistent) store.
-
Constructor Details
-
FixedDurationExpirationSessionRepository
public FixedDurationExpirationSessionRepository(@NonNull org.springframework.session.SessionRepository<S> sessionRepository, @Nullable Duration expirationTimeout) Constructs a new instance ofFixedDurationExpirationSessionRepositoryinitialized with the given data store specificSessionRepository.- Parameters:
sessionRepository-SessionRepositorydelegate.expirationTimeout-Durationspecifying the length of time until theSessionexpires.- Throws:
IllegalArgumentException- ifSessionRepositoryis null.- See Also:
-
SessionRepositoryDuration
-
-
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 anOptionalexpiraiton timeout.- Returns:
- an
Optionalexpiraiton timeout. - See Also:
-
createSession
Creates a new instance ofSession. TheSessioninstance will be managed by Apache Geode or Pivotal GemFire.- Specified by:
createSessionin interfaceorg.springframework.session.SessionRepository<S extends org.springframework.session.Session>- Returns:
- a new instance of
Session. - See Also:
-
Session
-
findById
Finds aSessionwith the givenID. This method will also perform a lazy expiration check to determine if theSessionhas already expired upon access, and if so, delete theSessionwith the givenID.- Specified by:
findByIdin interfaceorg.springframework.session.SessionRepository<S extends org.springframework.session.Session>- Parameters:
id-Stringcontaining the ID identifying theSessionto lookup.- Returns:
- the
Sessionwith the givenIDor null if noSessionwithIDexists or theSessionis expired. - See Also:
-
SessionhandleExpired(Session, Duration)getExpirationTimeout()
-
save
Saves the givenSessionto the underlying data (persistent) store.- Specified by:
savein interfaceorg.springframework.session.SessionRepository<S extends org.springframework.session.Session>- Parameters:
session-Sessionto save.- See Also:
-
Session
-
deleteById
Deletes theSessionidentified by the givenID.
-