/** * Calls {@code super.create(session)}, then caches the session keyed by the returned {@code sessionId}, and then * returns this {@code sessionId}. * * @param session Session object to create in the EIS and then cache. */ public Serializable create(Session session) { Serializable sessionId = super.create(session); cache(session, sessionId); return sessionId; }
/** * Caches the specified session under the cache entry key of {@code sessionId}. * * @param session the session to cache * @param sessionId the session id, to be used as the cache entry key. * @since 1.0 */ protected void cache(Session session, Serializable sessionId) { if (session == null || sessionId == null) { return; } Cache<Serializable, Session> cache = getActiveSessionsCacheLazy(); if (cache == null) { return; } cache(session, sessionId, cache); }
/** * Updates the state of the given session to the EIS by first delegating to * {@link #doUpdate(org.apache.shiro.session.Session)}. If the session is a {@link ValidatingSession}, it will * be added to the cache only if it is {@link ValidatingSession#isValid()} and if invalid, will be removed from the * cache. If it is not a {@code ValidatingSession} instance, it will be added to the cache in any event. * * @param session the session object to update in the EIS. * @throws UnknownSessionException if no existing EIS session record exists with the * identifier of {@link Session#getId() session.getId()} */ public void update(Session session) throws UnknownSessionException { doUpdate(session); if (session instanceof ValidatingSession) { if (((ValidatingSession) session).isValid()) { cache(session, session.getId()); } else { uncache(session); } } else { cache(session, session.getId()); } }
/** * Calls {@code super.create(session)}, then caches the session keyed by the returned {@code sessionId}, and then * returns this {@code sessionId}. * * @param session Session object to create in the EIS and then cache. */ public Serializable create(Session session) { Serializable sessionId = super.create(session); cache(session, sessionId); return sessionId; }
/** * Caches the specified session under the cache entry key of {@code sessionId}. * * @param session the session to cache * @param sessionId the session id, to be used as the cache entry key. * @since 1.0 */ protected void cache(Session session, Serializable sessionId) { if (session == null || sessionId == null) { return; } Cache<Serializable, Session> cache = getActiveSessionsCacheLazy(); if (cache == null) { return; } cache(session, sessionId, cache); }
/** * Updates the state of the given session to the EIS by first delegating to * {@link #doUpdate(org.apache.shiro.session.Session)}. If the session is a {@link ValidatingSession}, it will * be added to the cache only if it is {@link ValidatingSession#isValid()} and if invalid, will be removed from the * cache. If it is not a {@code ValidatingSession} instance, it will be added to the cache in any event. * * @param session the session object to update in the EIS. * @throws UnknownSessionException if no existing EIS session record exists with the * identifier of {@link Session#getId() session.getId()} */ public void update(Session session) throws UnknownSessionException { doUpdate(session); if (session instanceof ValidatingSession) { if (((ValidatingSession) session).isValid()) { cache(session, session.getId()); } else { uncache(session); } } else { cache(session, session.getId()); } }
/** * Calls {@code super.create(session)}, then caches the session keyed by the returned {@code sessionId}, and then * returns this {@code sessionId}. * * @param session Session object to create in the EIS and then cache. */ public Serializable create(Session session) { Serializable sessionId = super.create(session); cache(session, sessionId); return sessionId; }
/** * Caches the specified session under the cache entry key of {@code sessionId}. * * @param session the session to cache * @param sessionId the session id, to be used as the cache entry key. * @since 1.0 */ protected void cache(Session session, Serializable sessionId) { if (session == null || sessionId == null) { return; } Cache<Serializable, Session> cache = getActiveSessionsCacheLazy(); if (cache == null) { return; } cache(session, sessionId, cache); }
/** * Updates the state of the given session to the EIS by first delegating to * {@link #doUpdate(org.apache.shiro.session.Session)}. If the session is a {@link ValidatingSession}, it will * be added to the cache only if it is {@link ValidatingSession#isValid()} and if invalid, will be removed from the * cache. If it is not a {@code ValidatingSession} instance, it will be added to the cache in any event. * * @param session the session object to update in the EIS. * @throws UnknownSessionException if no existing EIS session record exists with the * identifier of {@link Session#getId() session.getId()} */ public void update(Session session) throws UnknownSessionException { doUpdate(session); if (session instanceof ValidatingSession) { if (((ValidatingSession) session).isValid()) { cache(session, session.getId()); } else { uncache(session); } } else { cache(session, session.getId()); } }