Skip to content

Commit

Permalink
Restore memcached in ConfigInfo and config-dist.php
Browse files Browse the repository at this point in the history
  • Loading branch information
csev committed Feb 14, 2024
1 parent 86b1fc5 commit 6724e1a
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 19 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

"nesbot/carbon" : "2.68.1",

"tsugi/lib": "dev-master#715bb90cc5913b7907f7a7e15dc71a52bfd8b4cc",
"tsugi/lib": "dev-master#a31404f87efd9c134f72c6197c0514c162993c57",
"koseu/lib": "dev-master#70c7ac1ca413c2dd541e078ebe07719405621b1b"
},
"config": {
Expand Down
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions config-dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,23 @@ function __the_end(){
}

// Store sessions in memcache - this seems like the fastest, best, and simplest
// way when running on AWS.
// http://php.net/manual/en/memcached.sessions.php
// way when running on AWS. There are two approaches - choose one.

// $CFG->memcache = 'tcp://memcache-tsugi.4984vw.cfg.use2.cache.amazonaws.com:11211';
if ( isset($CFG->memcache) && U::strlen($CFG->memcache) > 0 ) {
ini_set('session.save_handler', 'memcache');
ini_set('session.save_path', $CFG->memcache);
}

// Note no "tcp://" for the memcached version of the url
// $CFG->memcached = 'memcache-tsugi.4984vw.cfg.use2.cache.amazonaws.com:11211';
if ( isset($CFG->memcached) && strlen($CFG->memcached) > 0 ) {
ini_set('session.save_handler', 'memcached');
ini_set('session.save_path', $CFG->memcached);
// https://github.com/php-memcached-dev/php-memcached/issues/269
ini_set('memcached.sess_locking', '0');
}

// Redis sessions configuration
// $CFG->redis = 'tcp://localhost:6379?auth=addYourRedisPasswordHere';
if ( isset($CFG->redis) AND strlen($CFG->redis) > 0 ) {
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -7511,12 +7511,12 @@
"source": {
"type": "git",
"url": "https://github.com/tsugiproject/tsugi-php.git",
"reference": "715bb90cc5913b7907f7a7e15dc71a52bfd8b4cc"
"reference": "a31404f87efd9c134f72c6197c0514c162993c57"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tsugiproject/tsugi-php/zipball/715bb90cc5913b7907f7a7e15dc71a52bfd8b4cc",
"reference": "715bb90cc5913b7907f7a7e15dc71a52bfd8b4cc",
"url": "https://api.github.com/repos/tsugiproject/tsugi-php/zipball/a31404f87efd9c134f72c6197c0514c162993c57",
"reference": "a31404f87efd9c134f72c6197c0514c162993c57",
"shasum": ""
},
"require": {
Expand All @@ -7529,7 +7529,7 @@
"phpunit/php-timer": "v5.0.3",
"phpunit/phpunit": "9.*"
},
"time": "2024-02-11T21:49:42+00:00",
"time": "2024-02-14T06:20:42+00:00",
"default-branch": true,
"type": "library",
"installation-source": "dist",
Expand Down
6 changes: 3 additions & 3 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'db0a4db034c82a138661f0b22b8418a871e11ca4',
'reference' => '86b1fc5e88a4aa682d66d90737a4e464151a88c4',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand All @@ -13,7 +13,7 @@
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'db0a4db034c82a138661f0b22b8418a871e11ca4',
'reference' => '86b1fc5e88a4aa682d66d90737a4e464151a88c4',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down Expand Up @@ -1045,7 +1045,7 @@
'tsugi/lib' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '715bb90cc5913b7907f7a7e15dc71a52bfd8b4cc',
'reference' => 'a31404f87efd9c134f72c6197c0514c162993c57',
'type' => 'library',
'install_path' => __DIR__ . '/../tsugi/lib',
'aliases' => array(
Expand Down
37 changes: 33 additions & 4 deletions vendor/tsugi/lib/src/Config/ConfigInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,46 @@ class ConfigInfo {
/**
* Support memcache for session caching
*
* Store sessions in memcache - this seems like the fastest, best, and simplest approach
* when running on AWS.
* Memcache is php-only and so is likely to require less overall dependencies.
*
* http://php.net/manual/en/memcached.sessions.php
* http://php.net/manual/en/memcache.sessions.php
*
* Installed on Ubuntu using
*
* apt-get install -y php${TSUGI_PHP_VERSION}-memcache
*
* Note - prefer "memcache" over "memcached"
* You should only select one of memcache and memcached
*
* $CFG->memcache = 'tcp://memcache-tsugi.4984vw.cfg.use2.cache.amazonaws.com:11211';
*
* In addition to setting this variable, your config.php must include the code
* to configure the PHP session save handler as shown in config-dist.php
*
*/
public $memcache;

/**
* Support memcached for session caching
*
* Memcached is a combination of PHP and C and so may require extra dependencies.
*
* http://php.net/manual/en/memcached.sessions.php
*
* Installed on Ubuntu using
*
* apt-get install -y php${TSUGI_PHP_VERSION}-memcached
*
* You should only select one of memcache and memcached
*
* $CFG->memcached = 'memcache-tsugi.4984vw.cfg.use2.cache.amazonaws.com:11211';
*
* Note no "tcp://" for the memcached version of the url
*
* In addition to setting this variable, your config.php must include the code
* to configure the PHP session save handler as shown in config-dist.php
*/
public $memcached;

/**
* Adding in support for using Redis for session caching.
*
Expand Down

0 comments on commit 6724e1a

Please sign in to comment.