<?php class redis_server{ protected $_server = null; public function __construct(){ //parent::__construct(); $this->_server = new redis(); $result = $this->_server->connect('127.0.0.1',6379); if(!$result){ $this->_server = null; } return $this->_server; } public function set($key,$value){ $res = $this->_server->lpush($key,$value); print_r($res); } public function get($key){ $res = $this->_server->rpop($key); print_r($res); } } $model = new redis_server(); // $model->set('list','闪只想'); $model ->get('list');
我的封装的redis
最新推荐文章于 2024-08-30 20:47:31 发布