3 Commits

Author SHA1 Message Date
Jean-Baptiste Nahan
2663cd6aac Update composer.json 2019-04-02 09:20:29 +02:00
Macintoshplus
04075873b6 redme 2015-09-24 14:56:21 +02:00
Macintoshplus
62442e243a Fix config redis 2015-09-24 14:52:05 +02:00
4 changed files with 34 additions and 3 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 }

View File

@@ -6,7 +6,7 @@
"authors": [
{
"name": "Jean-Baptiste Nahan",
"email": "jbnahan@gmail.com"
"email": "macintoshplus@users.noreply.github.com"
}
],
"require": {
@@ -26,5 +26,6 @@
"branch-alias": {
"dev-master": "1.x-dev"
}
}
}
},
"abandoned": "doctrine/doctrine-cache-bundle"
}