package session-postgresql-async

  1. Overview
  2. Docs
A session manager for your everyday needs - Postgresql-specific support for Async

Install

Dune Dependency

Authors

Maintainers

Sources

0.5.0.tar.gz
sha256=bac89b05335fae06ba4d060687aa28578977a296cb46344784f16df1ba1f2360
md5=96a6cf425da69c010ecef492af339e8c

doc/session-postgresql-async/Session_postgresql_async/index.html

Module Session_postgresql_asyncSource

PostgreSQL backend using the Session.S.Future signature with Async.

The default expiry period is one week. The code expects the following table and index to be in pace:

CREATE TABLE IF NOT EXISTS session (
  session_key       char(40),
  expire_date       timestamp (2) with time zone,
  session_data      text
);

CREATE INDEX session_key_idx ON session (session_key);

Note that this module does not do utilize non-blocking IO but instead runs each synchronous operation in a thread.

include Session.S.Future with type t = Postgresql.connection and type +'a io = 'a Async.Deferred.t and type key = string and type value = string and type period = int64
type !'a io = 'a Async.Deferred.t
type key = string
type value = string
type period = int64
val default_period : t -> period
val generate : ?expiry:period -> ?value:value -> t -> key io
val clear : t -> key -> unit io
val get : t -> key -> (value * period, Session__S.error) result io
val set : ?expiry:period -> t -> key -> value -> unit io
Sourceval connect : ?host:string -> ?hostaddr:string -> ?port:string -> ?dbname:string -> ?user:string -> ?password:string -> ?options:string -> ?tty:string -> ?requiressl:string -> ?conninfo:string -> ?startonly:bool -> unit -> t Async.Deferred.t

Create a connection to a postgresql database.

This is an alias for the connection constructor. If you have an existing connection to a database with the appropriate tables set up, you are more than welcome to use it.

Sourceval set_default_period : t -> period -> unit

set_default_period t period sets the default expiry period of t. This will only affect future operations.

Sourcemodule Pool : sig ... end

PostgreSQL backend using the Session.S.Future siganture with Aysnc, together with connection pooling via a Throttle

OCaml

Innovation. Community. Security.