Php+Redis 实现Redis提供的lua脚本功能

<?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);
?>

Php+Redis 实现Redis提供的lua脚本功能,布布扣,bubuko.com

Php+Redis 实现Redis提供的lua脚本功能

上一篇:CSS代码优化(转载)


下一篇:[转载]ASP.NET对路径"xxxxx"的访问被拒绝的解决方法小结