2 Commits
1.0.0 ... 1.0.1

Author SHA1 Message Date
Macintoshplus
04075873b6 redme 2015-09-24 14:56:21 +02:00
Macintoshplus
62442e243a Fix config redis 2015-09-24 14:52:05 +02:00
3 changed files with 30 additions and 0 deletions

View File

@@ -32,6 +32,8 @@ class Configuration implements ConfigurationInterface
->cannotBeEmpty()
->end()
->arrayNode('options')
->useAttributeAsKey('opt_name', true)
->prototype('scalar')->end()
->end()
->end()
->end()

View File

@@ -31,6 +31,14 @@ mactronique_php_cache:
drivers:
-
name: xcache
-
name: redis
options:
host: 127.0.0.1
port: 6379
password: ''
database: 1
timeout: 1
-
name: memcached
options:
@@ -42,6 +50,25 @@ mactronique_php_cache:
name: "null"
```
# Use
In controller :
```
// Set value into key for 30 seconds
$this->get('mactronique_cache.phpcache')->set('key', 'value', 30);
// Set value into key
$this->get('mactronique_cache.phpcache')->set('key', 'value');
//get key
$this->get('mactronique_cache.phpcache')->get('key');
//check if key exists
$this->get('mactronique_cache.phpcache')->exists('key');
//remove key
$this->get('mactronique_cache.phpcache')->remove('key');
```
# Contributing
Please fork main repo and send a pull request with your change.

View File

@@ -1,5 +1,6 @@
services:
mactronique_cache.redis:
class: Mactronique\PhpCache\Driver\RedisDriver
arguments: ['%mactronique_cache.redis.options%']
tags:
- { name: mactronique_cache.driver }