Returns the {@code SessionIdGenerator} used by the {@link #generateSessionId(hunt.shiro.session.Session)} method. Unless overridden by the {@link #setSessionIdGenerator(SessionIdGenerator)} method, the default instance is a {@link JavaUuidSessionIdGenerator}.
Sets the {@code SessionIdGenerator} used by the {@link #generateSessionId(hunt.shiro.session.Session)} method. Unless overridden by this method, the default instance ss a {@link JavaUuidSessionIdGenerator}.
Generates a new ID to be applied to the specified {@code session} instance. This method is usually called from within a subclass's {@link #doCreate} implementation where they assign the returned id to the session instance and then create a record with this ID in the EIS data store. <p/> Subclass implementations backed by EIS data stores that auto-generate IDs during record creation, such as relational databases, don't need to use this method or the {@link #getSessionIdGenerator() sessionIdGenerator} attribute - they can simply return the data store's generated ID from the {@link #doCreate} implementation if desired. <p/> This implementation uses the {@link #setSessionIdGenerator configured} {@link SessionIdGenerator} to create the ID.
Creates the session by delegating EIS creation to subclasses via the {@link #doCreate} method, and then asserting that the returned sessionId is not null.
Utility method available to subclasses that wish to assign a generated session ID to the session instance directly. This method is not used by the {@code AbstractSessionDAO} implementation directly, but it is provided so subclasses don't need to know the {@code Session} implementation if they don't need to. <p/> This default implementation casts the argument to a {@link SimpleSession}, Shiro's default EIS implementation.
Subclass hook to actually persist the given <tt>Session</tt> instance to the underlying EIS.
Retrieves the Session object from the underlying EIS identified by <tt>sessionId</tt> by delegating to the {@link #doReadSession(java.io.Serializable)} method. If {@code null} is returned from that method, an {@link UnknownSessionException} will be thrown.
Subclass implementation hook that retrieves the Session object from the underlying EIS or {@code null} if a session with that ID could not be found.
Simple memory-based implementation of the SessionDAO that stores all of its sessions in an in-memory {@link ConcurrentMap}. <b>This implementation does not page to disk and is therefore unsuitable for applications that could experience a large amount of sessions</b> and would therefore cause {@code OutOfMemoryException}s. It is <em>not</em> recommended for production use in most environments. <h2>Memory Restrictions</h2> If your application is expected to host many sessions beyond what can be stored in the memory available to the JVM, it is highly recommended to use a different {@code SessionDAO} implementation which uses a more expansive or permanent backing data store. <p/> In this case, it is recommended to instead use a custom {@link CachingSessionDAO} implementation that communicates with a higher-capacity data store of your choice (file system, database, etc). <h2>Changes in 1.0</h2> This implementation prior to 1.0 used to subclass the {@link CachingSessionDAO}, but this caused problems with many cache implementations that would expunge entries due to TTL settings, resulting in Sessions that would be randomly (and permanently) lost. The Shiro 1.0 release refactored this implementation to be 100% memory-based (without {@code Cache} usage to avoid this problem.
@see CachingSessionDAO