Added possiblity to connect to redis via a unix socket (#1055)

* Added possiblity to connect to redis via a unix socket

* Improved redis via socket config usage and added config option to blueprints

* Updated Changelog

* Improved redis via socket by adding a default value and a placeholder in the blueprint
This commit is contained in:
Bernhard Altendorfer
2016-09-21 18:45:13 +02:00
committed by Andy Miller
parent afc7963644
commit 584f4efcb1
4 changed files with 18 additions and 1 deletions

View File

@@ -3,6 +3,7 @@
1. [](#improved)
* Add `batch()` function to Page Collection class
* Added new `cache.redis.socket` setting that allow to pass a UNIX socket as redis server
# v1.1.5
## 09/09/2016

View File

@@ -515,6 +515,13 @@ form:
help: PLUGIN_ADMIN.MEMCACHED_PORT_HELP
placeholder: "11211"
cache.redis.socket:
type: text
size: medium
label: PLUGIN_ADMIN.REDIS_SOCKET
help: PLUGIN_ADMIN.REDIS_SOCKET_HELP
placeholder: "/var/run/redis/redis.sock"
cache.redis.server:
type: text
size: medium

View File

@@ -72,6 +72,8 @@ cache:
prefix: 'g' # Cache prefix string (prevents cache conflicts)
lifetime: 604800 # Lifetime of cached data in seconds (0 = infinite)
gzip: false # GZip compress the page output
redis:
socket: false # Path to redis unix socket (e.g. /var/run/redis/redis.sock), false = use server and port to connect
twig:
cache: true # Set to true to enable Twig caching

View File

@@ -196,8 +196,15 @@ class Cache extends Getters
case 'redis':
$redis = new \Redis();
$redis->connect($this->config->get('system.cache.redis.server', 'localhost'),
$socket = $this->config->get('system.cache.redis.socket', false);
if ($socket) {
$redis->connect($socket);
} else {
$redis->connect($this->config->get('system.cache.redis.server', 'localhost'),
$this->config->get('system.cache.redis.port', 6379));
}
$driver = new DoctrineCache\RedisCache();
$driver->setRedis($redis);
break;