php - Set options for ZADD command in laravel redis -


i'm trying set options zadd laravel redis failing.

the option need set nx, stated in documentation:

zadd options (redis 3.0.2 or greater)

zadd supports list of options, specified after name of key , before first score argument.

so wrote this:

$this->redis->zadd('orderids:' . $category, 'nx',[$orderid => $timestamp[1]]); 

the error message

php warning: strlen() expects parameter 1 string, array given in /redimail/vendor/predis/predis/src/connection/streamconnection.php on line 270

i tried use put 'nx' other positions, laravel doesn't seem idea of using options zadd.

is there way laravel or need use way of setting sorted set options?

i'm using redis 3.0.2.

from predis/predis:

    class zsetadd extends command {     /**      * {@inheritdoc}      */     public function getid()     {         return 'zadd';     }     /**      * {@inheritdoc}      */     protected function filterarguments(array $arguments)     {         if (count($arguments) === 2 && is_array($arguments[1])) {             $flattened = array($arguments[0]);             foreach ($arguments[1] $member => $score) {                 $flattened[] = $score;                 $flattened[] = $member;             }             return $flattened;         }         return $arguments;     } } 

doesn't predis accepting options, or missing something?

until predis' zadd method updated support changes in redis v3.0.2, best bet explore wonderful world of rawcommand: https://github.com/nrk/predis/blob/master/src/command/rawcommand.php

it should let construct own commands, including zadd nx ... variant.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -