session: Add support for Memcache as a session backend #2031

Merged
merged 3 commits into from May 13, 2015

Projects

None yet

2 participants

@greezybacon
Member

This adds support for Memcache server(s) as a session storage backend. This is useful for higher traffic sites as it removes a database write per request. Therefore, read requests can be truly read; without database writes. Multiple Memcache servers are supported and used redundantly so that as long as at least one Memcache server remains reachable, session data will not be lost before it expires.

greezybacon added some commits May 8, 2015
@greezybacon greezybacon session: Add support for Memcache as a session backend 282c0fb
@greezybacon greezybacon autocron: Release agent session before running
The PHP session system will hold a lock on the session until it is released.
It is important to release the session before performing long-running tasks
so that further requests from the agent are not locked.
b076f50
@greezybacon greezybacon commented on an outdated diff May 12, 2015
include/class.ostsession.php
- array(&$this, 'gc')
- );
-
- //Start the session.
+ if (!defined('SESSION_BACKEND'))
+ define('SESSION_BACKEND', 'db');
+
+ try {
+ $bk = SESSION_BACKEND;
+ if (!class_exists(self::$backends[$bk]))
+ $bk = 'db';
+ $this->backend = new self::$backends[$bk]($this->ttl);
+ }
+ catch (Exception $x) {
+ // Use the database for sessions
+ $this->backend = new self::$backends['db']($this->ttl);
@greezybacon
greezybacon May 12, 2015 Member

Emit a PHP warning here

@protich protich merged commit 27f80cc into osTicket:develop May 13, 2015

1 check failed

continuous-integration/codeship Build failed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment