diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b4d4176 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,36 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +## [1.2.0] - 2021-02-08 +- added `fortrabbit\MemcachedEnabler\MemCache` class +- wrapped `setValues()` and `setValue()` in a try / catch + +## [1.1.1] - 2021-01-27 +Prevent warning `Memcached::addServer()` expects parameter 2 to be int, string given, thanks @joshuabaker + +## [1.1.0] - 2019-10-18 +Added fault-tolerant multi-server support 🎉 +by applying the following options: + +Redundancy + +``` +Memcached::OPT_REMOVE_FAILED_SERVERS: true +Memcached::OPT_RETRY_TIMEOUT: 2 +Memcached::OPT_LIBKETAMA_COMPATIBLE: true +Memcached::OPT_NUMBER_OF_REPLICAS: 1 +``` + +Timeouts + +``` +Memcached::OPT_POLL_TIMEOUT: 50 ms +Memcached::OPT_SEND_TIMEOUT: 50 ms +Memcached::OPT_RECV_TIMEOUT: 50 ms +Memcached::OPT_CONNECT_TIMEOUT: 50 ms +``` + +## [1.0.0] + +Initial release diff --git a/composer.json b/composer.json index 901553a..4fc64c2 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,7 @@ { "name": "fortrabbit/yii-memcached", "description": "Memcached Session & Cache for Craft3 / Yii2 on fortrabbit", - "version": "1.1.1", "type": "yii2-extension", - "keywords": ["yii2", "craftcms", "caching", "cache", "memcached", "memcache", "session"], "license": "MIT", "authors": [ diff --git a/src/Bootstrap.php b/src/Bootstrap.php index 10c2f6f..d3bd64b 100644 --- a/src/Bootstrap.php +++ b/src/Bootstrap.php @@ -4,7 +4,6 @@ use yii\base\BootstrapInterface; use yii\base\InvalidConfigException; -use yii\caching\MemCache; /** * Class Bootstrap diff --git a/src/MemCache.php b/src/MemCache.php new file mode 100644 index 0000000..eedc187 --- /dev/null +++ b/src/MemCache.php @@ -0,0 +1,33 @@ +getMessage()); + return array_keys($data); + } + } + + /** + * @inheritDoc + */ + protected function setValue($key, $value, $duration) + { + try { + return parent::setValue($key, $value, $duration); + } catch (\ErrorException $exception) { + error_log('MemcachedEnabler: ' . $exception->getMessage()); + return false; + } + } +}