shibazi

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
<?php
  require_once "predis-0.8/autoload.php";
  $config['schema'] = 'tcp';
  $config['host']= "192.168.1.7";
  $config['port'] = 6379;
  $redis = new Predis\Client($config);
  class wode extends Predis\Command\ScriptedCommand {
    public function getKyesCount(){
      return false;
    }
    public function getScript(){
      return 
<<<LUA
local result = {}
for i,v in ipairs(KEYS) do
  result[i] = redis.call("HGETALL",v)
end
return result
LUA;
    }
  }
  $redis->getProfile()->defineCommand('ri','wode');
  $a = $redis->ri(0,'tt1','tt2','tt3');
  print_r($a);
?>
posted on 2014-07-20 19:23  一生学习,何来毕业  阅读(1044)  评论(0编辑  收藏  举报