me.chanjar.weixin.common.session

## 接口 InternalSessionManager

所有已知实现类:
  StandardSessionManager

    public interface InternalSessionManager

### 方法概要

方法
`void` `add(InternalSession session)` Add this Session to the set of active Sessions for this Manager.
`void` `backgroundProcess()` Implements the Manager interface, direct call to processExpires
`InternalSession` `createEmptySession()` Get a session from the recycled ones or create a new empty one.
`InternalSession` `createSession(String sessionId)` Construct and return a new session object, based on the default settings specified by this Manager's properties.
`InternalSession` `findSession(String id)` Return the active Session, associated with this Manager, with the specified session id (if any); otherwise return `null`.
`InternalSession[]` `findSessions()`
`int` `getActiveSessions()` Returns the number of active sessions
`void` `remove(InternalSession session)` Remove this Session from the active Sessions for this Manager.
`void` `remove(InternalSession session, boolean update)` Remove this Session from the active Sessions for this Manager.
`void` `setBackgroundProcessorDelay(int backgroundProcessorDelay)` Set the manager background processor delay 设置manager sleep几秒，尝试执行一次background操作（清理过期session）
`void` `setMaxActiveSessions(int max)` Set the maximum number of active Sessions allowed, or -1 for no limit.
`void` `setMaxInactiveInterval(int interval)` Set the default maximum inactive interval (in seconds) for Sessions created by this Manager.
`void` `setProcessExpiresFrequency(int processExpiresFrequency)` Set the manager checks frequency.

### 方法详细资料

#### findSession

    InternalSession findSession(String id)

Return the active Session, associated with this Manager, with the specified session id (if any); otherwise return `null`.

参数:
  `id` - The session id for the session to be returned
抛出:
  `IllegalStateException` - if a new session cannot be instantiated for any reason
  `IOException` - if an input/output error occurs while processing this request

#### createSession

    InternalSession createSession(String sessionId)

Construct and return a new session object, based on the default settings specified by this Manager's properties. The session id specified will be used as the session id. If a new session cannot be created for any reason, return `null`.

参数:
  `sessionId` - The session id which should be used to create the new session; if `null`, a new session id will be generated
抛出:
  `IllegalStateException` - if a new session cannot be instantiated for any reason

#### remove

    void remove(InternalSession session)

Remove this Session from the active Sessions for this Manager.

参数:
  `session` - Session to be removed

#### remove

    void remove(InternalSession session,
              boolean update)

Remove this Session from the active Sessions for this Manager.

参数:
  `session` - Session to be removed
  `update` - Should the expiration statistics be updated

#### add

    void add(InternalSession session)

Add this Session to the set of active Sessions for this Manager.

参数:
  `session` - Session to be added

#### getActiveSessions

    int getActiveSessions()

Returns the number of active sessions

返回:
  number of sessions active

#### createEmptySession

    InternalSession createEmptySession()

Get a session from the recycled ones or create a new empty one. The PersistentManager manager does not need to create session data because it reads it from the Store.

#### findSessions

    InternalSession[] findSessions()

#### backgroundProcess

    void backgroundProcess()

Implements the Manager interface, direct call to processExpires

#### setMaxInactiveInterval

    void setMaxInactiveInterval(int interval)

Set the default maximum inactive interval (in seconds) for Sessions created by this Manager.

参数:
  `interval` - The new default value

#### setProcessExpiresFrequency

    void setProcessExpiresFrequency(int processExpiresFrequency)

     Set the manager checks frequency.
     设置每尝试多少次清理过期session，才真的会执行一次清理动作
     要和setBackgroundProcessorDelay(int)联合起来看
     如果把这个数字设置为6（默认），那么就是说manager要等待 6 * backgroundProcessorDay的时间才会清理过期session

参数:
  `processExpiresFrequency` - the new manager checks frequency

#### setBackgroundProcessorDelay

    void setBackgroundProcessorDelay(int backgroundProcessorDelay)

     Set the manager background processor delay
     设置manager sleep几秒，尝试执行一次background操作（清理过期session）

参数:
  `backgroundProcessorDelay` -

#### setMaxActiveSessions

    void setMaxActiveSessions(int max)

Set the maximum number of active Sessions allowed, or -1 for no limit. 设置最大活跃session数，默认无限

参数:
  `max` - The new maximum number of sessions