Class SessionCache
java.lang.Object
com.djrapitops.plan.gathering.cache.SessionCache
This class is used to store active sessions of players in memory.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncacheSession(UUID playerUUID, ActiveSession newSession)
Cache a new session.static void
clear()
endSession(UUID playerUUID, long time)
endSession(UUID playerUUID, long time, ActiveSession activeSession)
End a session and save it to database.static Collection<ActiveSession>
static Optional<ActiveSession>
getCachedSession(UUID playerUUID)
Used to get the Session of the player in the sessionCache.static void
-
Constructor Details
-
SessionCache
@Inject public SessionCache()
-
-
Method Details
-
getActiveSessions
-
clear
public static void clear() -
refreshActiveSessionsState
public static void refreshActiveSessionsState() -
getCachedSession
Used to get the Session of the player in the sessionCache.- Parameters:
playerUUID
- UUID of the player.- Returns:
- Optional with the session inside it if found.
-
cacheSession
Cache a new session.- Parameters:
playerUUID
- UUID of the playernewSession
- Session to cache.- Returns:
- Optional: previous session. Recipients of this object should decide if it needs to be saved.
-
endSession
public Optional<FinishedSession> endSession(UUID playerUUID, long time, ActiveSession activeSession)End a session and save it to database.- Parameters:
playerUUID
- UUID of the player.time
- Time the session ended.activeSession
- Currently active session- Returns:
- Optional: ended session. Recipients of this object should decide if it needs to be saved.
-
endSession
-