|
1 | 1 | {-# LANGUAGE FlexibleInstances #-} |
2 | 2 |
|
| 3 | +-- | |
| 4 | +-- Module: Network.Wai.Session.PostgreSQL |
| 5 | +-- Copyright: (C) 2015, Hans-Christian Esperer |
| 6 | +-- License: BSD3 |
| 7 | +-- Maintainer: Hans-Christian Esperer <hc@hcesperer.org> |
| 8 | +-- Stability: experimental |
| 9 | +-- Portability: portable |
| 10 | +-- |
| 11 | +-- Simple PostgreSQL backed wai-session backend. This module allows you to store |
| 12 | +-- session data of wai-sessions in a PostgreSQL database. Two tables are kept, one |
| 13 | +-- to store the session's metadata and one to store key,value pairs for each session. |
| 14 | +-- All keys and values are stored as bytea values in the postgresql database using |
| 15 | +-- haskell's cereal module to serialize and deserialize them. |
| 16 | +-- |
| 17 | +-- Please note that the module does not let you configure the names of the database |
| 18 | +-- tables. It is recommended to use this module with its own database schema. |
3 | 19 | module Network.Wai.Session.PostgreSQL |
4 | | - ( clearSession |
5 | | - , dbStore |
| 20 | + ( dbStore |
| 21 | + , clearSession |
6 | 22 | , defaultSettings |
7 | 23 | , fromSimpleConnection |
8 | 24 | , purgeOldSessions |
@@ -85,6 +101,10 @@ fromSimpleConnection connection = do |
85 | 101 | mvar <- newMVar () |
86 | 102 | return $ SimpleConnection (mvar, connection) |
87 | 103 |
|
| 104 | +-- |A simple PostgreSQL connection stored together with a mutex that |
| 105 | +-- prevents from running more than one postgresql transaction at |
| 106 | +-- the same time. It is recommended to use a connection pool |
| 107 | +-- instead for larger sites. |
88 | 108 | newtype SimpleConnection = SimpleConnection (MVar (), Connection) |
89 | 109 |
|
90 | 110 | instance WithPostgreSQLConn SimpleConnection where |
|
0 commit comments