<div dir="ltr"><div>Hi there!</div><div><br></div><div>I have a question regarding how to better work with redis eval functionality.</div><div></div><div>For the current moment I'm trying to implement this using usual cache_raw_query() function.<br></div><div><br></div><div>Here is an example of the simple eval call, that basically checks if a value is a member of the set:<br>$var(script_body) = "\"local str = ARGV[1]; for i=1,str:len(),1 do if (1 == redis.call('sismember', 'certain_keys_set', str:sub(1,i))) then return 1; end; end; return 0;\"";</div><div><br></div><div>Then I call it with:<br></div><div>cache_raw_query("redis:opensips", "EVAL $var(script_body) 0 $rU", "$avp(result)");</div><div><br></div><div>The obstacle I've come across is that for some reason, cachedb_redis module throws the following error:<br>"ERROR:cachedb_redis:redis_raw_query_send: Redis operation failure - ERR value is not an integer or out of range"</div><div><br></div><div>This script works out well though, when I insert this directly into redis-cli.<br></div><div><br></div><div>I have an idea, that this can be caused by zero "0" following the script body.</div><div>I tried to convert zero into integer with {<a href="http://s.int">s.int</a>} but this gave no result.</div><div><br></div><div>I also tried to escape the whole body script with {s.escape.common} but this also didn't work out.</div><div>On the other hand, I tried to escape all semicolons, colons, single and double quotations with a usual escape symbol "\", and this also doesn't give any good result.<br></div><div><br></div><div>From what I understand, this is kind of an issue related to formatting of string I'm trying to send to the Redis server.</div><div>And if I understand this correctly, OpenSIPS does nothing else, but pass the input string to the redisvCommand() API function. So I'm pretty confident this has to do something with formatting.<br></div><div><br></div><div>Might be there is some known method, I need use in order to properly encode my string (script body) before being able to send it to Redis?</div><div>For e.g. using using base64 or somewhat like that.<br></div><div><br></div><div>In any way, I appreciate all ideas on the matter!<br> </div><div><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr"><font style="background-color:rgb(255,255,255)" color="#0b5394">Best regards,<br></font></div><div dir="ltr"><font style="background-color:rgb(255,255,255)" color="#0b5394">Donat Zenichev<br><br></font></div></div></div></div></div></div></div></div></div></div>