• 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 PredisClient($config);
      class wode extends PredisCommandScriptedCommand {
        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);
    ?>
  • 相关阅读:
    9.4
    9.3
    9.2
    2016.9.1
    html,body
    prototype
    京东笔试题的一些小细节
    gulp安装过程中的问题。
    json
    双飞翼布局和圣杯布局
  • 原文地址:https://www.cnblogs.com/shibazi/p/3856564.html
Copyright © 2020-2023  润新知