Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kalaspuff/redis-cache-zend-framework
🗄 Redis cache backend for Zend Framework with support for tags. Uses PHP module phpredis. [not actively maintained]
https://github.com/kalaspuff/redis-cache-zend-framework
cache php redis zend-framework
Last synced: about 2 months ago
JSON representation
🗄 Redis cache backend for Zend Framework with support for tags. Uses PHP module phpredis. [not actively maintained]
- Host: GitHub
- URL: https://github.com/kalaspuff/redis-cache-zend-framework
- Owner: kalaspuff
- License: bsd-3-clause
- Created: 2012-10-09T11:58:48.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2018-11-23T01:26:31.000Z (about 6 years ago)
- Last Synced: 2024-12-08T03:51:40.712Z (2 months ago)
- Topics: cache, php, redis, zend-framework
- Language: PHP
- Homepage:
- Size: 27.3 KB
- Stars: 44
- Watchers: 10
- Forks: 30
- Open Issues: 6
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
Redis cache backend for Zend Framework by Carl Oscar Aaro
=============
Requires the phpredis extension for PHP to enable PHP to communicate with the [Redis](http://redis.io/) key-value store.
Start with installing the phpredis PHP extension available at https://github.com/nicolasff/phpredisSet up the Redis cache backend by invoking the following code somewhere in your project.
$redisCache = Zend_Cache::factory(
new Zend_Cache_Core(array(
'lifetime' => 3600,
'automatic_serialization' => true,
)),
new Extended_Cache_Backend_Redis(array(
'servers' => array(
array(
'host' => '127.0.0.1',
'port' => 6379,
'dbindex' => 1,
// 'persistent' => false, // not a persistent connection
// 'auth' => true, // enable authentication
// 'password' => 'mypwd000000', // password to authenticate on redis server
),
),
// 'key_prefix' => 'my_app', // if desire to add a prefix to all cache keys
))
);Writing and reading from the cache works the same way as all other Zend Framework cache backends.
$cacheKey = 'my_key';
$data = 'e48e13207341b6bffb7fb1622282247b';/* Save data to cache */
$redisCache->save($data, $cacheKey, array('tag1', 'tag2'));/* Load data from cache */
$data = $redisCache->load($cacheKey);/* Clear all keys with tag 'tag1' */
$redisCache->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('tag1'));/* Clear all cache (flush cache) */
$redisCache->clean(Zend_Cache::CLEANING_MODE_ALL);