mirror of
https://github.com/getgrav/grav.git
synced 2026-07-05 23:39:16 +02:00
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:
committed by
Andy Miller
parent
afc7963644
commit
584f4efcb1
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user