コード例 #1
0
ファイル: RedisClient.php プロジェクト: JanPetr/Redis
 /**
  * Execute a Lua script server side
  */
 public function evalScript($script, array $keys = array(), array $args = array())
 {
     $script = trim($script);
     $result = $this->send('evalsha', array(sha1($script), array_merge($keys, $args), count($keys)));
     if ($result === FALSE && stripos($this->driver->getLastError(), 'NOSCRIPT') !== FALSE) {
         $this->driver->clearLastError();
         $sha = $this->driver->script('load', $script);
         $result = $this->send('evalsha', array($sha, array_merge($keys, $args), count($keys)));
     }
     return $result;
 }