yuzuru-s / cakephp-redis
Redis DataSource Plugin for CakePHP
Installs: 73
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:cakephp-plugin
Requires
- php: >=5.3.0
- composer/installers: *
This package is not auto-updated.
Last update: 2024-12-17 19:30:44 UTC
README
Redis DataSource Plugin for CakePHP This repo is a copy of nanapi/cakephp-redis.git. Because it has been deleted.
Requirements
- PHP5
- CakePHP2
- pecl redis
Installation
cd app/Plugin
git clone git@github.com:YuzuruS/cakephp-redis.git Redis
app/Config/bootstrap.php
CakePlugin::load('Redis');
app/Config/database.php
<?php class DATABASE_CONFIG { public $redis = array( 'datasource' => 'Redis.RedisSource', 'host' => 'localhost', 'port' => '6379', 'db' => '0' );
How to use it
your model
<?php App::uses('RedisModel', 'Redis.Model'); class MyRedis extends RedisModel { }
your controller
<?php App::uses('AppController', 'Controller'); class MyController extends AppController { public $uses = array( 'MyRedis'; ); public function index() { $this->MyRedis->set('key', 'value'); $this->MyRedis->get('key'); $this->MyRedis->incr('pv'); } }
Methods
This is a wrapper for phpredis. For a list of methods that can be used by the Model, please refer to the README for phpredis.