Mongo.Session.SessionPool (mongodb-driver v1.4.0) View Source

A FIFO cache for sessions. To get a new session, call checkout. This returns a new session or a cached session. After running the operation call checkin(session) to put the session into the FIFO cache for reuse.

The MongoDB specifications allows to generate the uuid from the client. That means, that we can just create server sessions and use them for logicial sessions. If they expire then we drop these sessions, otherwise we can reuse the server sessions.

Link to this section Summary

Functions

Checkin a used server session. It if is already expired, the server session is dropped. Otherwise the server session is cache for reuse, until it expires due of being cached all the time.

Return a server session. If the session timeout is not reached, then a cached server session is return for reuse. Otherwise a newly created server session is returned.

Link to this section Types

Specs

session_pool() :: %{
  :pool_size => any(),
  :queue => [Mongo.Session.ServerSession.t()],
  :timeout => any(),
  optional(any()) => any()
}

Link to this section Functions

Specs

Checkin a used server session. It if is already expired, the server session is dropped. Otherwise the server session is cache for reuse, until it expires due of being cached all the time.

Specs

Return a server session. If the session timeout is not reached, then a cached server session is return for reuse. Otherwise a newly created server session is returned.

Link to this function

new(logical_session_timeout, opts \\ [])

View Source