Add support for Memcached/Improve database cache

- Create Cache Driver interface
- Update cache table fields
- Add CacheSessionHandler
This commit is contained in:
Hypolite Petovan 2018-02-28 23:48:09 -05:00
parent 7bd4a52156
commit 3628b62aeb
9 changed files with 326 additions and 192 deletions

View file

@ -5,8 +5,8 @@
*/
namespace Friendica\Core;
use Friendica\Core\Session\CacheSessionHandler;
use Friendica\Core\Session\DatabaseSessionHandler;
use Friendica\Core\Session\MemcacheSessionHandler;
/**
* High-level Session service class
@ -28,10 +28,10 @@ class Session
ini_set('session.cookie_secure', 1);
}
if (!Config::get('system', 'disable_database_session')) {
$memcache = Cache::memcache();
if (is_object($memcache)) {
$SessionHandler = new MemcacheSessionHandler($memcache);
$session_handler = Config::get('system', 'session_handler', 'database');
if ($session_handler != 'native') {
if ($session_handler == 'cache' && Config::get('system', 'cache_driver', 'database') != 'database') {
$SessionHandler = new CacheSessionHandler();
} else {
$SessionHandler = new DatabaseSessionHandler();
}