úÎ1'.ð      (C) 2015, Hans-Christian EspererBSD3)Hans-Christian Esperer <hc@hcesperer.org> experimentalportableNone35ÕA simple PostgreSQL connection stored together with a mutex that prevents from running more than one postgresql transaction at the same time. It is recommended to use a connection pool instead for larger sites.ÿžBy default, you pass a postgresql connection to the session store when creating it. The passed connection will have to stay open for the (possibly very long) existence of the session and it should not be used for any other purpose during that time. You can implement an instance of this class for a connection pool instead, so that the session manager will not require a permanent open PostgreSQL connection.TCall the function (Connection -> IO b) with a valid and open PostgreSQL connection.8These settings control how the session store is behavingŽThe number of seconds a session is valid Seconds are counted since the session is last accessed (read or written), not since it was created.½A random session key generator. The session ID should provide sufficient entropy, and must not be predictable. It is recommended to use a cryptographically secure random number generator.®Whether to create the database table if it does not exist upon creating the session store. If set to false, the database table must exist or be created by some other means.YA function that is called by to log events such as session purges or the table creation. VThe number of microseconds to sleep between two runs of the old session purge worker. ÿ Prepare a simple postgresql connection for use by the postgresql session store. This basically wraps the connection along with a mutex to ensure transactions work correctly. Connections used this way must not be used anywhere else for the duration of the session store! It is recommended to use a connection pool instead. To use a connection pool, you simply need to implement the WithPostgreSQLConn type class. 1Create a new postgresql backed wai session store. *Delete expired sessions from the database. HRun a thread using forkIO that runs periodically to purge old sessions.¯Create default settings using a session timeout of one hour, a cryptographically secure session id generator using 24 bytes of entropy and putStrLn to log events to stdout.-Generate a session ID with n bytes of entropyÿœThis function can be called to invalidate a session and enforce creating a new one with a new session ID. It should be called *before* any calls to sessionStore are made. It needs to be passed a request and the cookie name explicitly due to the limited nature of the Network.Wai.Session interface. Sessions should be cleared when a login is performed, to prevent certain kinds of session hijacking attacks.+  !"#$%&'()*    #  !"#$%&'()*+      !"#$%&'()*+waise_8lEK4VGU6s94EDml8KmNxBNetwork.Wai.Session.PostgreSQLSimpleConnectionWithPostgreSQLConnwithPostgreSQLConn StoreSettingsstoreSettingsSessionTimeoutstoreSettingsKeyGenstoreSettingsCreateTablestoreSettingsLogstoreSettingsPurgeIntervalfromSimpleConnectiondbStorepurgeOldSessionspurgerdefaultSettingsratherSecureGen clearSessionqryCreateTable1qryCreateTable2qryCreateSessionqryCreateSessionEntryqryUpdateSessionqryUpdateSessionEntryqryLookupSessionqryLookupSession'qryLookupSession''qryLookupSession'''qryPurgeOldSessionsqryCheckNewKeyqryInvalidateSess1qryInvalidateSess2 qryUpdateKey prettyPrintdbStore'backendreaderwriterignoreSqlErrorunerror$fWithPostgreSQLConnPool$$fWithPostgreSQLConnSimpleConnection$fDefaultStoreSettings