首先配置好环境,这里就不多说了redis服务端,以及redis的PHP扩展包;
View Code
<?php
require 'redis.php';
require 'redis_pool.php';
require 'redis_peer.php';
class note extends redis_peer {}
$note = new note();
# Create note, primary key is generated automatically
$id = $note->insert( array('title' => 'Hello', 'body' => 'world!') );
# Update note
$id = $note->update( $id, array('body' => 'wwwwworld!') );
# Get some note by primary key
$note_data = $note->get_by_id( $id );
# Delete note $note->delete( $id );