redis_cluster.php 121 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575
  1. <?php
  2. /**
  3. * Helper autocomplete for php redis cluster extension.
  4. * Based on the phpredis-phpdoc by Max Kamashev (https://github.com/ukko/phpredis-phpdoc)
  5. *
  6. * @author Tommy Zheng <tommy@vlv.pw>
  7. * @link https://github.com/zgb7mtr/phpredis_cluster_phpdoc
  8. *
  9. * @method mixed eval($script, $args = array(), $numKeys = 0)
  10. *
  11. */
  12. class RedisCluster {
  13. const AFTER = 'after';
  14. const BEFORE = 'before';
  15. /**
  16. * Options
  17. */
  18. const OPT_SERIALIZER = 1;
  19. const OPT_PREFIX = 2;
  20. const OPT_READ_TIMEOUT = 3;
  21. const OPT_SCAN = 4;
  22. const OPT_SLAVE_FAILOVER = 5;
  23. /**
  24. * Cluster options
  25. */
  26. const FAILOVER_NONE = 0;
  27. const FAILOVER_ERROR = 1;
  28. const FAILOVER_DISTRIBUTE = 2;
  29. const FAILOVER_DISTRIBUTE_SLAVES = 3;
  30. /**
  31. * SCAN options
  32. */
  33. const SCAN_NORETRY = 0;
  34. const SCAN_RETRY = 1;
  35. /**
  36. * @since 5.3.0
  37. */
  38. const SCAN_PREFIX = 2;
  39. /**
  40. * @since 5.3.0
  41. */
  42. const SCAN_NOPREFIX = 3;
  43. /**
  44. * Serializers
  45. */
  46. const SERIALIZER_NONE = 0;
  47. const SERIALIZER_PHP = 1;
  48. const SERIALIZER_IGBINARY = 2;
  49. const SERIALIZER_MSGPACK = 3;
  50. const SERIALIZER_JSON = 4;
  51. /**
  52. * Multi
  53. */
  54. const ATOMIC = 0;
  55. const MULTI = 1;
  56. const PIPELINE = 2;
  57. /**
  58. * Type
  59. */
  60. const REDIS_NOT_FOUND = 0;
  61. const REDIS_STRING = 1;
  62. const REDIS_SET = 2;
  63. const REDIS_LIST = 3;
  64. const REDIS_ZSET = 4;
  65. const REDIS_HASH = 5;
  66. /**
  67. * Creates a Redis Cluster client
  68. *
  69. * @param string|null $name
  70. * @param array $seeds
  71. * @param float $timeout
  72. * @param float $readTimeout
  73. * @param bool $persistent
  74. * @param string|string[]|null $auth
  75. * @param array $connectionParameters extra config to send to redis
  76. * @throws RedisClusterException
  77. *
  78. * @example
  79. * <pre>
  80. * // Declaring a cluster with an array of seeds
  81. * $redisCluster = new RedisCluster(null,['127.0.0.1:6379']);
  82. *
  83. * // Loading a cluster configuration by name
  84. * // In order to load a named array, one must first define the seed nodes in redis.ini.
  85. * // The following lines would define the cluster 'mycluster', and be loaded automatically by phpredis.
  86. *
  87. * // # In redis.ini
  88. * // redis.clusters.seeds = "mycluster[]=localhost:7000&test[]=localhost:7001"
  89. * // redis.clusters.timeout = "mycluster=5"
  90. * // redis.clusters.read_timeout = "mycluster=10"
  91. *
  92. * //Then, this cluster can be loaded by doing the following
  93. *
  94. * $redisClusterPro = new RedisCluster('mycluster');
  95. * $redisClusterDev = new RedisCluster('test');
  96. * </pre>
  97. */
  98. public function __construct($name, $seeds, $timeout = null, $readTimeout = null, $persistent = false, $auth = null, $connectionParameters = []) { }
  99. /**
  100. * Disconnects from the Redis instance, except when pconnect is used.
  101. */
  102. public function close() { }
  103. /**
  104. * Get the value related to the specified key
  105. *
  106. * @param string $key
  107. *
  108. * @return string|false If key didn't exist, FALSE is returned. Otherwise, the value related to this key is
  109. * returned.
  110. *
  111. * @link https://redis.io/commands/get
  112. * @example
  113. * <pre>
  114. * $redisCluster->get('key');
  115. * </pre>
  116. */
  117. public function get($key) { }
  118. /**
  119. * Set the string value in argument as value of the key.
  120. *
  121. * @since If you're using Redis >= 2.6.12, you can pass extended options as explained in example
  122. *
  123. * @param string $key
  124. * @param string $value
  125. * @param int|array $timeout If you pass an integer, phpredis will redirect to SETEX, and will try to use Redis
  126. * >= 2.6.12 extended options if you pass an array with valid values.
  127. *
  128. * @return bool TRUE if the command is successful.
  129. *
  130. * @link https://redis.io/commands/set
  131. * @example
  132. * <pre>
  133. * // Simple key -> value set
  134. * $redisCluster->set('key', 'value');
  135. *
  136. * // Will redirect, and actually make an SETEX call
  137. * $redisCluster->set('key','value', 10);
  138. *
  139. * // Will set the key, if it doesn't exist, with a ttl of 10 seconds
  140. * $redisCluster->set('key', 'value', Array('nx', 'ex'=>10));
  141. *
  142. * // Will set a key, if it does exist, with a ttl of 1000 milliseconds
  143. * $redisCluster->set('key', 'value', Array('xx', 'px'=>1000));
  144. * </pre>
  145. */
  146. public function set($key, $value, $timeout = null) { }
  147. /**
  148. * Returns the values of all specified keys.
  149. *
  150. * For every key that does not hold a string value or does not exist,
  151. * the special value false is returned. Because of this, the operation never fails.
  152. *
  153. * @param array $array
  154. *
  155. * @return array
  156. *
  157. * @link https://redis.io/commands/mget
  158. * @example
  159. * <pre>
  160. * $redisCluster->del('x', 'y', 'z', 'h'); // remove x y z
  161. * $redisCluster->mset(array('x' => 'a', 'y' => 'b', 'z' => 'c'));
  162. * $redisCluster->hset('h', 'field', 'value');
  163. * var_dump($redisCluster->mget(array('x', 'y', 'z', 'h')));
  164. * // Output:
  165. * // array(3) {
  166. * // [0]=>
  167. * // string(1) "a"
  168. * // [1]=>
  169. * // string(1) "b"
  170. * // [2]=>
  171. * // string(1) "c"
  172. * // [3]=>
  173. * // bool(false)
  174. * // }
  175. * </pre>
  176. */
  177. public function mget(array $array) { }
  178. /**
  179. * Sets multiple key-value pairs in one atomic command.
  180. * MSETNX only returns TRUE if all the keys were set (see SETNX).
  181. *
  182. * @param array $array Pairs: array(key => value, ...)
  183. *
  184. * @return bool TRUE in case of success, FALSE in case of failure.
  185. * @link https://redis.io/commands/mset
  186. * @example
  187. * <pre>
  188. * $redisCluster->mset(array('key0' => 'value0', 'key1' => 'value1'));
  189. * var_dump($redisCluster->get('key0'));
  190. * var_dump($redisCluster->get('key1'));
  191. * // Output:
  192. * // string(6) "value0"
  193. * // string(6) "value1"
  194. * </pre>
  195. */
  196. public function mset(array $array) { }
  197. /**
  198. * @see mset()
  199. *
  200. * @param array $array
  201. *
  202. * @return int 1 (if the keys were set) or 0 (no key was set)
  203. * @link https://redis.io/commands/msetnx
  204. */
  205. public function msetnx(array $array) { }
  206. /**
  207. * Remove specified keys.
  208. *
  209. * @param int|string|array $key1 An array of keys, or an undefined number of parameters, each a key: key1 key2 key3
  210. * ... keyN
  211. * @param int|string ...$otherKeys
  212. *
  213. * @return int Number of keys deleted.
  214. * @link https://redis.io/commands/del
  215. * @example
  216. * <pre>
  217. * $redisCluster->set('key1', 'val1');
  218. * $redisCluster->set('key2', 'val2');
  219. * $redisCluster->set('key3', 'val3');
  220. * $redisCluster->set('key4', 'val4');
  221. * $redisCluster->del('key1', 'key2'); // return 2
  222. * $redisCluster->del(array('key3', 'key4')); // return 2
  223. * </pre>
  224. */
  225. public function del($key1, ...$otherKeys) { }
  226. /**
  227. * Set the string value in argument as value of the key, with a time to live.
  228. *
  229. * @param string $key
  230. * @param int $ttl
  231. * @param string $value
  232. *
  233. * @return bool TRUE if the command is successful.
  234. * @link https://redis.io/commands/setex
  235. * @example
  236. * <pre>
  237. * $redisCluster->setex('key', 3600, 'value'); // sets key → value, with 1h TTL.
  238. * </pre>
  239. */
  240. public function setex($key, $ttl, $value) { }
  241. /**
  242. * PSETEX works exactly like SETEX with the sole difference that the expire time is specified in milliseconds
  243. * instead of seconds.
  244. *
  245. * @param string $key
  246. * @param int $ttl
  247. * @param string $value
  248. *
  249. * @return bool TRUE if the command is successful.
  250. * @link https://redis.io/commands/psetex
  251. * @example
  252. * <pre>
  253. * $redisCluster->psetex('key', 1000, 'value'); // sets key → value, with 1s TTL.
  254. * </pre>
  255. */
  256. public function psetex($key, $ttl, $value) { }
  257. /**
  258. * Set the string value in argument as value of the key if the key doesn't already exist in the database.
  259. *
  260. * @param string $key
  261. * @param string $value
  262. *
  263. * @return bool TRUE in case of success, FALSE in case of failure.
  264. * @link https://redis.io/commands/setnx
  265. * @example
  266. * <pre>
  267. * $redisCluster->setnx('key', 'value'); // return TRUE
  268. * $redisCluster->setnx('key', 'value'); // return FALSE
  269. * </pre>
  270. */
  271. public function setnx($key, $value) { }
  272. /**
  273. * Sets a value and returns the previous entry at that key.
  274. *
  275. * @param string $key
  276. * @param string $value
  277. *
  278. * @return string A string, the previous value located at this key.
  279. * @link https://redis.io/commands/getset
  280. * @example
  281. * <pre>
  282. * $redisCluster->set('x', '42');
  283. * $exValue = $redisCluster->getSet('x', 'lol'); // return '42', replaces x by 'lol'
  284. * $newValue = $redisCluster->get('x'); // return 'lol'
  285. * </pre>
  286. */
  287. public function getSet($key, $value) { }
  288. /**
  289. * Verify if the specified key exists.
  290. *
  291. * @param string $key
  292. *
  293. * @return bool If the key exists, return TRUE, otherwise return FALSE.
  294. * @link https://redis.io/commands/exists
  295. * @example
  296. * <pre>
  297. * $redisCluster->set('key', 'value');
  298. * $redisCluster->exists('key'); // TRUE
  299. * $redisCluster->exists('NonExistingKey'); // FALSE
  300. * </pre>
  301. */
  302. public function exists($key) { }
  303. /**
  304. * Returns the keys that match a certain pattern.
  305. *
  306. * @param string $pattern pattern, using '*' as a wildcard.
  307. *
  308. * @return array of STRING: The keys that match a certain pattern.
  309. * @link https://redis.io/commands/keys
  310. * @example
  311. * <pre>
  312. * $allKeys = $redisCluster->keys('*'); // all keys will match this.
  313. * $keyWithUserPrefix = $redisCluster->keys('user*');
  314. * </pre>
  315. */
  316. public function keys($pattern) { }
  317. /**
  318. * Returns the type of data pointed by a given key.
  319. *
  320. * @param string $key
  321. *
  322. * @return int
  323. *
  324. * Depending on the type of the data pointed by the key,
  325. * this method will return the following value:
  326. * - string: RedisCluster::REDIS_STRING
  327. * - set: RedisCluster::REDIS_SET
  328. * - list: RedisCluster::REDIS_LIST
  329. * - zset: RedisCluster::REDIS_ZSET
  330. * - hash: RedisCluster::REDIS_HASH
  331. * - other: RedisCluster::REDIS_NOT_FOUND
  332. * @link https://redis.io/commands/type
  333. * @example $redisCluster->type('key');
  334. */
  335. public function type($key) { }
  336. /**
  337. * Returns and removes the first element of the list.
  338. *
  339. * @param string $key
  340. *
  341. * @return string|false if command executed successfully BOOL FALSE in case of failure (empty list)
  342. * @link https://redis.io/commands/lpop
  343. * @example
  344. * <pre>
  345. * $redisCluster->rPush('key1', 'A');
  346. * $redisCluster->rPush('key1', 'B');
  347. * $redisCluster->rPush('key1', 'C');
  348. * var_dump( $redisCluster->lRange('key1', 0, -1) );
  349. * // Output:
  350. * // array(3) {
  351. * // [0]=> string(1) "A"
  352. * // [1]=> string(1) "B"
  353. * // [2]=> string(1) "C"
  354. * // }
  355. * $redisCluster->lPop('key1');
  356. * var_dump( $redisCluster->lRange('key1', 0, -1) );
  357. * // Output:
  358. * // array(2) {
  359. * // [0]=> string(1) "B"
  360. * // [1]=> string(1) "C"
  361. * // }
  362. * </pre>
  363. */
  364. public function lPop($key) { }
  365. /**
  366. * Returns and removes the last element of the list.
  367. *
  368. * @param string $key
  369. *
  370. * @return string|false if command executed successfully BOOL FALSE in case of failure (empty list)
  371. * @link https://redis.io/commands/rpop
  372. * @example
  373. * <pre>
  374. * $redisCluster->rPush('key1', 'A');
  375. * $redisCluster->rPush('key1', 'B');
  376. * $redisCluster->rPush('key1', 'C');
  377. * var_dump( $redisCluster->lRange('key1', 0, -1) );
  378. * // Output:
  379. * // array(3) {
  380. * // [0]=> string(1) "A"
  381. * // [1]=> string(1) "B"
  382. * // [2]=> string(1) "C"
  383. * // }
  384. * $redisCluster->rPop('key1');
  385. * var_dump( $redisCluster->lRange('key1', 0, -1) );
  386. * // Output:
  387. * // array(2) {
  388. * // [0]=> string(1) "A"
  389. * // [1]=> string(1) "B"
  390. * // }
  391. * </pre>
  392. */
  393. public function rPop($key) { }
  394. /**
  395. * Set the list at index with the new value.
  396. *
  397. * @param string $key
  398. * @param int $index
  399. * @param string $value
  400. *
  401. * @return bool TRUE if the new value is setted. FALSE if the index is out of range, or data type identified by key
  402. * is not a list.
  403. * @link https://redis.io/commands/lset
  404. * @example
  405. * <pre>
  406. * $redisCluster->rPush('key1', 'A');
  407. * $redisCluster->rPush('key1', 'B');
  408. * $redisCluster->rPush('key1', 'C'); // key1 => [ 'A', 'B', 'C' ]
  409. * $redisCluster->lGet('key1', 0); // 'A'
  410. * $redisCluster->lSet('key1', 0, 'X');
  411. * $redisCluster->lGet('key1', 0); // 'X'
  412. * </pre>
  413. */
  414. public function lSet($key, $index, $value) { }
  415. /**
  416. * Removes and returns a random element from the set value at Key.
  417. *
  418. * @param string $key
  419. *
  420. * @return string "popped" value
  421. * bool FALSE if set identified by key is empty or doesn't exist.
  422. * @link https://redis.io/commands/spop
  423. * @example
  424. * <pre>
  425. * $redisCluster->sAdd('key1' , 'set1');
  426. * $redisCluster->sAdd('key1' , 'set2');
  427. * $redisCluster->sAdd('key1' , 'set3');
  428. * var_dump($redisCluster->sMembers('key1'));// 'key1' => {'set3', 'set1', 'set2'}
  429. * $redisCluster->sPop('key1');// 'set1'
  430. * var_dump($redisCluster->sMembers('key1'));// 'key1' => {'set3', 'set2'}
  431. * $redisCluster->sPop('key1');// 'set3',
  432. * var_dump($redisCluster->sMembers('key1'));// 'key1' => {'set2'}
  433. * </pre>
  434. */
  435. public function sPop($key) { }
  436. /**
  437. * Adds the string values to the head (left) of the list. Creates the list if the key didn't exist.
  438. * If the key exists and is not a list, FALSE is returned.
  439. *
  440. * @param string $key
  441. * @param string $value1 String, value to push in key
  442. * @param string $value2 Optional
  443. * @param string $valueN Optional
  444. *
  445. * @return int|false The new length of the list in case of success, FALSE in case of Failure.
  446. * @link https://redis.io/commands/lpush
  447. * @example
  448. * <pre>
  449. * $redisCluster->lPush('l', 'v1', 'v2', 'v3', 'v4') // int(4)
  450. * var_dump( $redisCluster->lRange('l', 0, -1) );
  451. * //// Output:
  452. * // array(4) {
  453. * // [0]=> string(2) "v4"
  454. * // [1]=> string(2) "v3"
  455. * // [2]=> string(2) "v2"
  456. * // [3]=> string(2) "v1"
  457. * // }
  458. * </pre>
  459. */
  460. public function lPush($key, $value1, $value2 = null, $valueN = null) { }
  461. /**
  462. * Adds the string values to the tail (right) of the list. Creates the list if the key didn't exist.
  463. * If the key exists and is not a list, FALSE is returned.
  464. *
  465. * @param string $key
  466. * @param string $value1 String, value to push in key
  467. * @param string $value2 Optional
  468. * @param string $valueN Optional
  469. *
  470. * @return int|false The new length of the list in case of success, FALSE in case of Failure.
  471. * @link https://redis.io/commands/rpush
  472. * @example
  473. * <pre>
  474. * $redisCluster->rPush('r', 'v1', 'v2', 'v3', 'v4'); // int(4)
  475. * var_dump( $redisCluster->lRange('r', 0, -1) );
  476. * //// Output:
  477. * // array(4) {
  478. * // [0]=> string(2) "v1"
  479. * // [1]=> string(2) "v2"
  480. * // [2]=> string(2) "v3"
  481. * // [3]=> string(2) "v4"
  482. * // }
  483. * </pre>
  484. */
  485. public function rPush($key, $value1, $value2 = null, $valueN = null) { }
  486. /**
  487. * BLPOP is a blocking list pop primitive.
  488. * It is the blocking version of LPOP because it blocks the connection when
  489. * there are no elements to pop from any of the given lists.
  490. * An element is popped from the head of the first list that is non-empty,
  491. * with the given keys being checked in the order that they are given.
  492. *
  493. * @param array $keys Array containing the keys of the lists
  494. * Or STRING Key1 STRING Key2 STRING Key3 ... STRING Keyn
  495. * @param int $timeout Timeout
  496. *
  497. * @return array array('listName', 'element')
  498. * @link https://redis.io/commands/blpop
  499. * @example
  500. * <pre>
  501. * // Non blocking feature
  502. * $redisCluster->lPush('key1', 'A');
  503. * $redisCluster->del('key2');
  504. *
  505. * $redisCluster->blPop('key1', 'key2', 10); // array('key1', 'A')
  506. * // OR
  507. * $redisCluster->blPop(array('key1', 'key2'), 10); // array('key1', 'A')
  508. *
  509. * $redisCluster->brPop('key1', 'key2', 10); // array('key1', 'A')
  510. * // OR
  511. * $redisCluster->brPop(array('key1', 'key2'), 10); // array('key1', 'A')
  512. *
  513. * // Blocking feature
  514. *
  515. * // process 1
  516. * $redisCluster->del('key1');
  517. * $redisCluster->blPop('key1', 10);
  518. * // blocking for 10 seconds
  519. *
  520. * // process 2
  521. * $redisCluster->lPush('key1', 'A');
  522. *
  523. * // process 1
  524. * // array('key1', 'A') is returned
  525. * </pre>
  526. */
  527. public function blPop(array $keys, $timeout) { }
  528. /**
  529. * BRPOP is a blocking list pop primitive.
  530. * It is the blocking version of RPOP because it blocks the connection when
  531. * there are no elements to pop from any of the given lists.
  532. * An element is popped from the tail of the first list that is non-empty,
  533. * with the given keys being checked in the order that they are given.
  534. * See the BLPOP documentation(https://redis.io/commands/blpop) for the exact semantics,
  535. * since BRPOP is identical to BLPOP with the only difference being that
  536. * it pops elements from the tail of a list instead of popping from the head.
  537. *
  538. * @param array $keys Array containing the keys of the lists
  539. * Or STRING Key1 STRING Key2 STRING Key3 ... STRING Keyn
  540. * @param int $timeout Timeout
  541. *
  542. * @return array array('listName', 'element')
  543. * @link https://redis.io/commands/brpop
  544. * @example
  545. * <pre>
  546. * // Non blocking feature
  547. * $redisCluster->lPush('key1', 'A');
  548. * $redisCluster->del('key2');
  549. *
  550. * $redisCluster->blPop('key1', 'key2', 10); // array('key1', 'A')
  551. * // OR
  552. * $redisCluster->blPop(array('key1', 'key2'), 10); // array('key1', 'A')
  553. *
  554. * $redisCluster->brPop('key1', 'key2', 10); // array('key1', 'A')
  555. * // OR
  556. * $redisCluster->brPop(array('key1', 'key2'), 10); // array('key1', 'A')
  557. *
  558. * // Blocking feature
  559. *
  560. * // process 1
  561. * $redisCluster->del('key1');
  562. * $redisCluster->blPop('key1', 10);
  563. * // blocking for 10 seconds
  564. *
  565. * // process 2
  566. * $redisCluster->lPush('key1', 'A');
  567. *
  568. * // process 1
  569. * // array('key1', 'A') is returned
  570. * </pre>
  571. */
  572. public function brPop(array $keys, $timeout) { }
  573. /**
  574. * Adds the string value to the tail (right) of the list if the ist exists. FALSE in case of Failure.
  575. *
  576. * @param string $key
  577. * @param string $value String, value to push in key
  578. *
  579. * @return int|false The new length of the list in case of success, FALSE in case of Failure.
  580. * @link https://redis.io/commands/rpushx
  581. * @example
  582. * <pre>
  583. * $redisCluster->del('key1');
  584. * $redisCluster->rPushx('key1', 'A'); // returns 0
  585. * $redisCluster->rPush('key1', 'A'); // returns 1
  586. * $redisCluster->rPushx('key1', 'B'); // returns 2
  587. * $redisCluster->rPushx('key1', 'C'); // returns 3
  588. * // key1 now points to the following list: [ 'A', 'B', 'C' ]
  589. * </pre>
  590. */
  591. public function rPushx($key, $value) { }
  592. /**
  593. * Adds the string value to the head (left) of the list if the list exists.
  594. *
  595. * @param string $key
  596. * @param string $value String, value to push in key
  597. *
  598. * @return int|false The new length of the list in case of success, FALSE in case of Failure.
  599. * @link https://redis.io/commands/lpushx
  600. * @example
  601. * <pre>
  602. * $redisCluster->del('key1');
  603. * $redisCluster->lPushx('key1', 'A'); // returns 0
  604. * $redisCluster->lPush('key1', 'A'); // returns 1
  605. * $redisCluster->lPushx('key1', 'B'); // returns 2
  606. * $redisCluster->lPushx('key1', 'C'); // returns 3
  607. * // key1 now points to the following list: [ 'C', 'B', 'A' ]
  608. * </pre>
  609. */
  610. public function lPushx($key, $value) { }
  611. /**
  612. * Insert value in the list before or after the pivot value. the parameter options
  613. * specify the position of the insert (before or after). If the list didn't exists,
  614. * or the pivot didn't exists, the value is not inserted.
  615. *
  616. * @param string $key
  617. * @param int $position RedisCluster::BEFORE | RedisCluster::AFTER
  618. * @param string $pivot
  619. * @param string $value
  620. *
  621. * @return int The number of the elements in the list, -1 if the pivot didn't exists.
  622. * @link https://redis.io/commands/linsert
  623. * @example
  624. * <pre>
  625. * $redisCluster->del('key1');
  626. * $redisCluster->lInsert('key1', RedisCluster::AFTER, 'A', 'X'); // 0
  627. *
  628. * $redisCluster->lPush('key1', 'A');
  629. * $redisCluster->lPush('key1', 'B');
  630. * $redisCluster->lPush('key1', 'C');
  631. *
  632. * $redisCluster->lInsert('key1', RedisCluster::BEFORE, 'C', 'X'); // 4
  633. * $redisCluster->lRange('key1', 0, -1); // array('X', 'C', 'B', 'A')
  634. *
  635. * $redisCluster->lInsert('key1', RedisCluster::AFTER, 'C', 'Y'); // 5
  636. * $redisCluster->lRange('key1', 0, -1); // array('X', 'C', 'Y', 'B', 'A')
  637. *
  638. * $redisCluster->lInsert('key1', RedisCluster::AFTER, 'W', 'value'); // -1
  639. * </pre>
  640. */
  641. public function lInsert($key, $position, $pivot, $value) { }
  642. /**
  643. * Return the specified element of the list stored at the specified key.
  644. * 0 the first element, 1 the second ... -1 the last element, -2 the penultimate ...
  645. * Return FALSE in case of a bad index or a key that doesn't point to a list.
  646. *
  647. * @param string $key
  648. * @param int $index
  649. *
  650. * @return string|false the element at this index
  651. * Bool FALSE if the key identifies a non-string data type, or no value corresponds to this index in the list Key.
  652. * @link https://redis.io/commands/lindex
  653. * @example
  654. * <pre>
  655. * $redisCluster->rPush('key1', 'A');
  656. * $redisCluster->rPush('key1', 'B');
  657. * $redisCluster->rPush('key1', 'C'); // key1 => [ 'A', 'B', 'C' ]
  658. * $redisCluster->lGet('key1', 0); // 'A'
  659. * $redisCluster->lGet('key1', -1); // 'C'
  660. * $redisCluster->lGet('key1', 10); // `FALSE`
  661. * </pre>
  662. */
  663. public function lIndex($key, $index) { }
  664. /**
  665. * Removes the first count occurrences of the value element from the list.
  666. * If count is zero, all the matching elements are removed. If count is negative,
  667. * elements are removed from tail to head.
  668. *
  669. * @param string $key
  670. * @param string $value
  671. * @param int $count
  672. *
  673. * @return int the number of elements to remove
  674. * bool FALSE if the value identified by key is not a list.
  675. * @link https://redis.io/commands/lrem
  676. * @example
  677. * <pre>
  678. * $redisCluster->lPush('key1', 'A');
  679. * $redisCluster->lPush('key1', 'B');
  680. * $redisCluster->lPush('key1', 'C');
  681. * $redisCluster->lPush('key1', 'A');
  682. * $redisCluster->lPush('key1', 'A');
  683. *
  684. * $redisCluster->lRange('key1', 0, -1); // array('A', 'A', 'C', 'B', 'A')
  685. * $redisCluster->lRem('key1', 'A', 2); // 2
  686. * $redisCluster->lRange('key1', 0, -1); // array('C', 'B', 'A')
  687. * </pre>
  688. */
  689. public function lRem($key, $value, $count) { }
  690. /**
  691. * A blocking version of rpoplpush, with an integral timeout in the third parameter.
  692. *
  693. * @param string $srcKey
  694. * @param string $dstKey
  695. * @param int $timeout
  696. *
  697. * @return string|false The element that was moved in case of success, FALSE in case of timeout.
  698. * @link https://redis.io/commands/brpoplpush
  699. */
  700. public function brpoplpush($srcKey, $dstKey, $timeout) { }
  701. /**
  702. * Pops a value from the tail of a list, and pushes it to the front of another list.
  703. * Also return this value.
  704. *
  705. * @since redis >= 1.2
  706. *
  707. * @param string $srcKey
  708. * @param string $dstKey
  709. *
  710. * @return string|false The element that was moved in case of success, FALSE in case of failure.
  711. * @link https://redis.io/commands/rpoplpush
  712. * @example
  713. * <pre>
  714. * $redisCluster->del('x', 'y');
  715. *
  716. * $redisCluster->lPush('x', 'abc');
  717. * $redisCluster->lPush('x', 'def');
  718. * $redisCluster->lPush('y', '123');
  719. * $redisCluster->lPush('y', '456');
  720. *
  721. * // move the last of x to the front of y.
  722. * var_dump($redisCluster->rpoplpush('x', 'y'));
  723. * var_dump($redisCluster->lRange('x', 0, -1));
  724. * var_dump($redisCluster->lRange('y', 0, -1));
  725. *
  726. * ////Output:
  727. * //
  728. * //string(3) "abc"
  729. * //array(1) {
  730. * // [0]=>
  731. * // string(3) "def"
  732. * //}
  733. * //array(3) {
  734. * // [0]=>
  735. * // string(3) "abc"
  736. * // [1]=>
  737. * // string(3) "456"
  738. * // [2]=>
  739. * // string(3) "123"
  740. * //}
  741. * </pre>
  742. */
  743. public function rpoplpush($srcKey, $dstKey) { }
  744. /**
  745. * Returns the size of a list identified by Key. If the list didn't exist or is empty,
  746. * the command returns 0. If the data type identified by Key is not a list, the command return FALSE.
  747. *
  748. * @param string $key
  749. *
  750. * @return int The size of the list identified by Key exists.
  751. * bool FALSE if the data type identified by Key is not list
  752. * @link https://redis.io/commands/llen
  753. * @example
  754. * <pre>
  755. * $redisCluster->rPush('key1', 'A');
  756. * $redisCluster->rPush('key1', 'B');
  757. * $redisCluster->rPush('key1', 'C'); // key1 => [ 'A', 'B', 'C' ]
  758. * $redisCluster->lLen('key1'); // 3
  759. * $redisCluster->rPop('key1');
  760. * $redisCluster->lLen('key1'); // 2
  761. * </pre>
  762. */
  763. public function lLen($key) { }
  764. /**
  765. * Returns the set cardinality (number of elements) of the set stored at key.
  766. *
  767. * @param string $key
  768. *
  769. * @return int the cardinality (number of elements) of the set, or 0 if key does not exist.
  770. * @link https://redis.io/commands/scard
  771. * @example
  772. * <pre>
  773. * $redisCluster->sAdd('key1' , 'set1');
  774. * $redisCluster->sAdd('key1' , 'set2');
  775. * $redisCluster->sAdd('key1' , 'set3'); // 'key1' => {'set1', 'set2', 'set3'}
  776. * $redisCluster->sCard('key1'); // 3
  777. * $redisCluster->sCard('keyX'); // 0
  778. * </pre>
  779. */
  780. public function sCard($key) { }
  781. /**
  782. * Returns all the members of the set value stored at key.
  783. * This has the same effect as running SINTER with one argument key.
  784. *
  785. * @param string $key
  786. *
  787. * @return array All elements of the set.
  788. * @link https://redis.io/commands/smembers
  789. * @example
  790. * <pre>
  791. * $redisCluster->del('s');
  792. * $redisCluster->sAdd('s', 'a');
  793. * $redisCluster->sAdd('s', 'b');
  794. * $redisCluster->sAdd('s', 'a');
  795. * $redisCluster->sAdd('s', 'c');
  796. * var_dump($redisCluster->sMembers('s'));
  797. *
  798. * ////Output:
  799. * //
  800. * //array(3) {
  801. * // [0]=>
  802. * // string(1) "b"
  803. * // [1]=>
  804. * // string(1) "c"
  805. * // [2]=>
  806. * // string(1) "a"
  807. * //}
  808. * // The order is random and corresponds to redis' own internal representation of the set structure.
  809. * </pre>
  810. */
  811. public function sMembers($key) { }
  812. /**
  813. * Returns if member is a member of the set stored at key.
  814. *
  815. * @param string $key
  816. * @param string $value
  817. *
  818. * @return bool TRUE if value is a member of the set at key key, FALSE otherwise.
  819. * @link https://redis.io/commands/sismember
  820. * @example
  821. * <pre>
  822. * $redisCluster->sAdd('key1' , 'set1');
  823. * $redisCluster->sAdd('key1' , 'set2');
  824. * $redisCluster->sAdd('key1' , 'set3'); // 'key1' => {'set1', 'set2', 'set3'}
  825. *
  826. * $redisCluster->sIsMember('key1', 'set1'); // TRUE
  827. * $redisCluster->sIsMember('key1', 'setX'); // FALSE
  828. * </pre>
  829. */
  830. public function sIsMember($key, $value) { }
  831. /**
  832. * Adds a values to the set value stored at key.
  833. * If this value is already in the set, FALSE is returned.
  834. *
  835. * @param string $key Required key
  836. * @param string $value1 Required value
  837. * @param string $value2 Optional value
  838. * @param string $valueN Optional value
  839. *
  840. * @return int|false The number of elements added to the set
  841. * @link https://redis.io/commands/sadd
  842. * @example
  843. * <pre>
  844. * $redisCluster->sAdd('k', 'v1'); // int(1)
  845. * $redisCluster->sAdd('k', 'v1', 'v2', 'v3'); // int(2)
  846. * </pre>
  847. */
  848. public function sAdd($key, $value1, $value2 = null, $valueN = null) { }
  849. /**
  850. * Adds a values to the set value stored at key.
  851. * If this value is already in the set, FALSE is returned.
  852. *
  853. * @param string $key Required key
  854. * @param array $valueArray
  855. *
  856. * @return int|false The number of elements added to the set
  857. * @example
  858. * <pre>
  859. * $redisCluster->sAddArray('k', ['v1', 'v2', 'v3']);
  860. * //This is a feature in php only. Same as $redisCluster->sAdd('k', 'v1', 'v2', 'v3');
  861. * </pre>
  862. */
  863. public function sAddArray($key, array $valueArray) { }
  864. /**
  865. * Removes the specified members from the set value stored at key.
  866. *
  867. * @param string $key
  868. * @param string $member1
  869. * @param string $member2
  870. * @param string $memberN
  871. *
  872. * @return int The number of elements removed from the set.
  873. * @link https://redis.io/commands/srem
  874. * @example
  875. * <pre>
  876. * var_dump( $redisCluster->sAdd('k', 'v1', 'v2', 'v3') ); // int(3)
  877. * var_dump( $redisCluster->sRem('k', 'v2', 'v3') ); // int(2)
  878. * var_dump( $redisCluster->sMembers('k') );
  879. * //// Output:
  880. * // array(1) {
  881. * // [0]=> string(2) "v1"
  882. * // }
  883. * </pre>
  884. */
  885. public function sRem($key, $member1, $member2 = null, $memberN = null) { }
  886. /**
  887. * Performs the union between N sets and returns it.
  888. *
  889. * @param string $key1 Any number of keys corresponding to sets in redis.
  890. * @param string $key2 ...
  891. * @param string $keyN ...
  892. *
  893. * @return array of strings: The union of all these sets.
  894. * @link https://redis.io/commands/sunionstore
  895. * @example
  896. * <pre>
  897. * $redisCluster->del('s0', 's1', 's2');
  898. *
  899. * $redisCluster->sAdd('s0', '1');
  900. * $redisCluster->sAdd('s0', '2');
  901. * $redisCluster->sAdd('s1', '3');
  902. * $redisCluster->sAdd('s1', '1');
  903. * $redisCluster->sAdd('s2', '3');
  904. * $redisCluster->sAdd('s2', '4');
  905. *
  906. * var_dump($redisCluster->sUnion('s0', 's1', 's2'));
  907. *
  908. * //// Output:
  909. * //
  910. * //array(4) {
  911. * // [0]=>
  912. * // string(1) "3"
  913. * // [1]=>
  914. * // string(1) "4"
  915. * // [2]=>
  916. * // string(1) "1"
  917. * // [3]=>
  918. * // string(1) "2"
  919. * //}
  920. * </pre>
  921. */
  922. public function sUnion($key1, $key2, $keyN = null) { }
  923. /**
  924. * Performs the same action as sUnion, but stores the result in the first key
  925. *
  926. * @param string $dstKey the key to store the diff into.
  927. * @param string $key1 Any number of keys corresponding to sets in redis.
  928. * @param string $key2 ...
  929. * @param string $keyN ...
  930. *
  931. * @return int Any number of keys corresponding to sets in redis.
  932. * @link https://redis.io/commands/sunionstore
  933. * @example
  934. * <pre>
  935. * $redisCluster->del('s0', 's1', 's2');
  936. *
  937. * $redisCluster->sAdd('s0', '1');
  938. * $redisCluster->sAdd('s0', '2');
  939. * $redisCluster->sAdd('s1', '3');
  940. * $redisCluster->sAdd('s1', '1');
  941. * $redisCluster->sAdd('s2', '3');
  942. * $redisCluster->sAdd('s2', '4');
  943. *
  944. * var_dump($redisCluster->sUnionStore('dst', 's0', 's1', 's2'));
  945. * var_dump($redisCluster->sMembers('dst'));
  946. *
  947. * //// Output:
  948. * //
  949. * //int(4)
  950. * //array(4) {
  951. * // [0]=>
  952. * // string(1) "3"
  953. * // [1]=>
  954. * // string(1) "4"
  955. * // [2]=>
  956. * // string(1) "1"
  957. * // [3]=>
  958. * // string(1) "2"
  959. * //}
  960. * </pre>
  961. */
  962. public function sUnionStore($dstKey, $key1, $key2, $keyN = null) { }
  963. /**
  964. * Returns the members of a set resulting from the intersection of all the sets
  965. * held at the specified keys. If just a single key is specified, then this command
  966. * produces the members of this set. If one of the keys is missing, FALSE is returned.
  967. *
  968. * @param string $key1 keys identifying the different sets on which we will apply the intersection.
  969. * @param string $key2 ...
  970. * @param string $keyN ...
  971. *
  972. * @return array contain the result of the intersection between those keys.
  973. * If the intersection between the different sets is empty, the return value will be empty array.
  974. * @link https://redis.io/commands/sinterstore
  975. * @example
  976. * <pre>
  977. * $redisCluster->sAdd('key1', 'val1');
  978. * $redisCluster->sAdd('key1', 'val2');
  979. * $redisCluster->sAdd('key1', 'val3');
  980. * $redisCluster->sAdd('key1', 'val4');
  981. *
  982. * $redisCluster->sAdd('key2', 'val3');
  983. * $redisCluster->sAdd('key2', 'val4');
  984. *
  985. * $redisCluster->sAdd('key3', 'val3');
  986. * $redisCluster->sAdd('key3', 'val4');
  987. *
  988. * var_dump($redisCluster->sInter('key1', 'key2', 'key3'));
  989. *
  990. * // Output:
  991. * //
  992. * //array(2) {
  993. * // [0]=>
  994. * // string(4) "val4"
  995. * // [1]=>
  996. * // string(4) "val3"
  997. * //}
  998. * </pre>
  999. */
  1000. public function sInter($key1, $key2, $keyN = null) { }
  1001. /**
  1002. * Performs a sInter command and stores the result in a new set.
  1003. *
  1004. * @param string $dstKey the key to store the diff into.
  1005. * @param string $key1 are intersected as in sInter.
  1006. * @param string $key2 ...
  1007. * @param string $keyN ...
  1008. *
  1009. * @return int|false The cardinality of the resulting set, or FALSE in case of a missing key.
  1010. * @link https://redis.io/commands/sinterstore
  1011. * @example
  1012. * <pre>
  1013. * $redisCluster->sAdd('key1', 'val1');
  1014. * $redisCluster->sAdd('key1', 'val2');
  1015. * $redisCluster->sAdd('key1', 'val3');
  1016. * $redisCluster->sAdd('key1', 'val4');
  1017. *
  1018. * $redisCluster->sAdd('key2', 'val3');
  1019. * $redisCluster->sAdd('key2', 'val4');
  1020. *
  1021. * $redisCluster->sAdd('key3', 'val3');
  1022. * $redisCluster->sAdd('key3', 'val4');
  1023. *
  1024. * var_dump($redisCluster->sInterStore('output', 'key1', 'key2', 'key3'));
  1025. * var_dump($redisCluster->sMembers('output'));
  1026. *
  1027. * //// Output:
  1028. * //
  1029. * //int(2)
  1030. * //array(2) {
  1031. * // [0]=>
  1032. * // string(4) "val4"
  1033. * // [1]=>
  1034. * // string(4) "val3"
  1035. * //}
  1036. * </pre>
  1037. */
  1038. public function sInterStore($dstKey, $key1, $key2, $keyN = null) { }
  1039. /**
  1040. * Performs the difference between N sets and returns it.
  1041. *
  1042. * @param string $key1 Any number of keys corresponding to sets in redis.
  1043. * @param string $key2 ...
  1044. * @param string $keyN ...
  1045. *
  1046. * @return array of strings: The difference of the first set will all the others.
  1047. * @link https://redis.io/commands/sdiff
  1048. * @example
  1049. * <pre>
  1050. * $redisCluster->del('s0', 's1', 's2');
  1051. *
  1052. * $redisCluster->sAdd('s0', '1');
  1053. * $redisCluster->sAdd('s0', '2');
  1054. * $redisCluster->sAdd('s0', '3');
  1055. * $redisCluster->sAdd('s0', '4');
  1056. *
  1057. * $redisCluster->sAdd('s1', '1');
  1058. * $redisCluster->sAdd('s2', '3');
  1059. *
  1060. * var_dump($redisCluster->sDiff('s0', 's1', 's2'));
  1061. *
  1062. * //// Output:
  1063. * //
  1064. * //array(2) {
  1065. * // [0]=>
  1066. * // string(1) "4"
  1067. * // [1]=>
  1068. * // string(1) "2"
  1069. * //}
  1070. * </pre>
  1071. */
  1072. public function sDiff($key1, $key2, $keyN = null) { }
  1073. /**
  1074. * Performs the same action as sDiff, but stores the result in the first key
  1075. *
  1076. * @param string $dstKey the key to store the diff into.
  1077. * @param string $key1 Any number of keys corresponding to sets in redis
  1078. * @param string $key2 ...
  1079. * @param string $keyN ...
  1080. *
  1081. * @return int|false The cardinality of the resulting set, or FALSE in case of a missing key.
  1082. * @link https://redis.io/commands/sdiffstore
  1083. * @example
  1084. * <pre>
  1085. * $redisCluster->del('s0', 's1', 's2');
  1086. *
  1087. * $redisCluster->sAdd('s0', '1');
  1088. * $redisCluster->sAdd('s0', '2');
  1089. * $redisCluster->sAdd('s0', '3');
  1090. * $redisCluster->sAdd('s0', '4');
  1091. *
  1092. * $redisCluster->sAdd('s1', '1');
  1093. * $redisCluster->sAdd('s2', '3');
  1094. *
  1095. * var_dump($redisCluster->sDiffStore('dst', 's0', 's1', 's2'));
  1096. * var_dump($redisCluster->sMembers('dst'));
  1097. *
  1098. * //// Output:
  1099. * //
  1100. * //int(2)
  1101. * //array(2) {
  1102. * // [0]=>
  1103. * // string(1) "4"
  1104. * // [1]=>
  1105. * // string(1) "2"
  1106. * //}
  1107. * </pre>
  1108. */
  1109. public function sDiffStore($dstKey, $key1, $key2, $keyN = null) { }
  1110. /**
  1111. * Returns a random element(s) from the set value at Key, without removing it.
  1112. *
  1113. * @param string $key
  1114. * @param int $count [optional]
  1115. *
  1116. * @return string|array value(s) from the set
  1117. * bool FALSE if set identified by key is empty or doesn't exist and count argument isn't passed.
  1118. * @link https://redis.io/commands/srandmember
  1119. * @example
  1120. * <pre>
  1121. * $redisCluster->sAdd('key1' , 'one');
  1122. * $redisCluster->sAdd('key1' , 'two');
  1123. * $redisCluster->sAdd('key1' , 'three'); // 'key1' => {'one', 'two', 'three'}
  1124. *
  1125. * var_dump( $redisCluster->sRandMember('key1') ); // 'key1' => {'one', 'two', 'three'}
  1126. *
  1127. * // string(5) "three"
  1128. *
  1129. * var_dump( $redisCluster->sRandMember('key1', 2) ); // 'key1' => {'one', 'two', 'three'}
  1130. *
  1131. * // array(2) {
  1132. * // [0]=> string(2) "one"
  1133. * // [1]=> string(2) "three"
  1134. * // }
  1135. * </pre>
  1136. */
  1137. public function sRandMember($key, $count = null) { }
  1138. /**
  1139. * Get the length of a string value.
  1140. *
  1141. * @param string $key
  1142. *
  1143. * @return int
  1144. * @link https://redis.io/commands/strlen
  1145. * @example
  1146. * <pre>
  1147. * $redisCluster->set('key', 'value');
  1148. * $redisCluster->strlen('key'); // 5
  1149. * </pre>
  1150. */
  1151. public function strlen($key) { }
  1152. /**
  1153. * Remove the expiration timer from a key.
  1154. *
  1155. * @param string $key
  1156. *
  1157. * @return bool TRUE if a timeout was removed, FALSE if the key didn’t exist or didn’t have an expiration timer.
  1158. * @link https://redis.io/commands/persist
  1159. * @example $redisCluster->persist('key');
  1160. */
  1161. public function persist($key) { }
  1162. /**
  1163. * Returns the remaining time to live of a key that has a timeout.
  1164. * This introspection capability allows a Redis client to check how many seconds a given key will continue to be
  1165. * part of the dataset. In Redis 2.6 or older the command returns -1 if the key does not exist or if the key exist
  1166. * but has no associated expire. Starting with Redis 2.8 the return value in case of error changed: Returns -2 if
  1167. * the key does not exist. Returns -1 if the key exists but has no associated expire.
  1168. *
  1169. * @param string $key
  1170. *
  1171. * @return int the time left to live in seconds.
  1172. * @link https://redis.io/commands/ttl
  1173. * @example $redisCluster->ttl('key');
  1174. */
  1175. public function ttl($key) { }
  1176. /**
  1177. * Returns the remaining time to live of a key that has an expire set,
  1178. * with the sole difference that TTL returns the amount of remaining time in seconds while PTTL returns it in
  1179. * milliseconds. In Redis 2.6 or older the command returns -1 if the key does not exist or if the key exist but has
  1180. * no associated expire. Starting with Redis 2.8 the return value in case of error changed: Returns -2 if the key
  1181. * does not exist. Returns -1 if the key exists but has no associated expire.
  1182. *
  1183. * @param string $key
  1184. *
  1185. * @return int the time left to live in milliseconds.
  1186. * @link https://redis.io/commands/pttl
  1187. * @example $redisCluster->pttl('key');
  1188. */
  1189. public function pttl($key) { }
  1190. /**
  1191. * Returns the cardinality of an ordered set.
  1192. *
  1193. * @param string $key
  1194. *
  1195. * @return int the set's cardinality
  1196. * @link https://redis.io/commands/zsize
  1197. * @example
  1198. * <pre>
  1199. * $redisCluster->zAdd('key', 0, 'val0');
  1200. * $redisCluster->zAdd('key', 2, 'val2');
  1201. * $redisCluster->zAdd('key', 10, 'val10');
  1202. * $redisCluster->zCard('key'); // 3
  1203. * </pre>
  1204. */
  1205. public function zCard($key) { }
  1206. /**
  1207. * Returns the number of elements of the sorted set stored at the specified key which have
  1208. * scores in the range [start,end]. Adding a parenthesis before start or end excludes it
  1209. * from the range. +inf and -inf are also valid limits.
  1210. *
  1211. * @param string $key
  1212. * @param string $start
  1213. * @param string $end
  1214. *
  1215. * @return int the size of a corresponding zRangeByScore.
  1216. * @link https://redis.io/commands/zcount
  1217. * @example
  1218. * <pre>
  1219. * $redisCluster->zAdd('key', 0, 'val0');
  1220. * $redisCluster->zAdd('key', 2, 'val2');
  1221. * $redisCluster->zAdd('key', 10, 'val10');
  1222. * $redisCluster->zCount('key', 0, 3); // 2, corresponding to array('val0', 'val2')
  1223. * </pre>
  1224. */
  1225. public function zCount($key, $start, $end) { }
  1226. /**
  1227. * Deletes the elements of the sorted set stored at the specified key which have scores in the range [start,end].
  1228. *
  1229. * @param string $key
  1230. * @param float|string $start double or "+inf" or "-inf" string
  1231. * @param float|string $end double or "+inf" or "-inf" string
  1232. *
  1233. * @return int The number of values deleted from the sorted set
  1234. * @link https://redis.io/commands/zremrangebyscore
  1235. * @example
  1236. * <pre>
  1237. * $redisCluster->zAdd('key', 0, 'val0');
  1238. * $redisCluster->zAdd('key', 2, 'val2');
  1239. * $redisCluster->zAdd('key', 10, 'val10');
  1240. * $redisCluster->zRemRangeByScore('key', 0, 3); // 2
  1241. * </pre>
  1242. */
  1243. public function zRemRangeByScore($key, $start, $end) { }
  1244. /**
  1245. * Returns the score of a given member in the specified sorted set.
  1246. *
  1247. * @param string $key
  1248. * @param string $member
  1249. *
  1250. * @return float
  1251. * @link https://redis.io/commands/zscore
  1252. * @example
  1253. * <pre>
  1254. * $redisCluster->zAdd('key', 2.5, 'val2');
  1255. * $redisCluster->zScore('key', 'val2'); // 2.5
  1256. * </pre>
  1257. */
  1258. public function zScore($key, $member) { }
  1259. /**
  1260. * Adds the specified member with a given score to the sorted set stored at key.
  1261. *
  1262. * @param string $key Required key
  1263. * @param float $score1 Required score
  1264. * @param string $value1 Required value
  1265. * @param float $score2 Optional score
  1266. * @param string $value2 Optional value
  1267. * @param float $scoreN Optional score
  1268. * @param string $valueN Optional value
  1269. *
  1270. * @return int Number of values added
  1271. * @link https://redis.io/commands/zadd
  1272. * @example
  1273. * <pre>
  1274. * $redisCluster->zAdd('z', 1, 'v2', 2, 'v2', 3, 'v3', 4, 'v4' ); // int(3)
  1275. * $redisCluster->zRem('z', 'v2', 'v3'); // int(2)
  1276. * var_dump( $redisCluster->zRange('z', 0, -1) );
  1277. *
  1278. * //// Output:
  1279. * // array(1) {
  1280. * // [0]=> string(2) "v4"
  1281. * // }
  1282. * </pre>
  1283. */
  1284. public function zAdd($key, $score1, $value1, $score2 = null, $value2 = null, $scoreN = null, $valueN = null) { }
  1285. /**
  1286. * Increments the score of a member from a sorted set by a given amount.
  1287. *
  1288. * @param string $key
  1289. * @param float $value (double) value that will be added to the member's score
  1290. * @param string $member
  1291. *
  1292. * @return float the new value
  1293. * @link https://redis.io/commands/zincrby
  1294. * @example
  1295. * <pre>
  1296. * $redisCluster->del('key');
  1297. * $redisCluster->zIncrBy('key', 2.5, 'member1');// key or member1 didn't exist, so member1's score is to 0 ;
  1298. * //before the increment and now has the value 2.5
  1299. * $redisCluster->zIncrBy('key', 1, 'member1'); // 3.5
  1300. * </pre>
  1301. */
  1302. public function zIncrBy($key, $value, $member) { }
  1303. /**
  1304. * Returns the length of a hash, in number of items
  1305. *
  1306. * @param string $key
  1307. *
  1308. * @return int|false the number of items in a hash, FALSE if the key doesn't exist or isn't a hash.
  1309. * @link https://redis.io/commands/hlen
  1310. * @example
  1311. * <pre>
  1312. * $redisCluster->del('h');
  1313. * $redisCluster->hSet('h', 'key1', 'hello');
  1314. * $redisCluster->hSet('h', 'key2', 'plop');
  1315. * $redisCluster->hLen('h'); // returns 2
  1316. * </pre>
  1317. */
  1318. public function hLen($key) { }
  1319. /**
  1320. * Returns the keys in a hash, as an array of strings.
  1321. *
  1322. * @param string $key
  1323. *
  1324. * @return array An array of elements, the keys of the hash. This works like PHP's array_keys().
  1325. * @link https://redis.io/commands/hkeys
  1326. * @example
  1327. * <pre>
  1328. * $redisCluster->del('h');
  1329. * $redisCluster->hSet('h', 'a', 'x');
  1330. * $redisCluster->hSet('h', 'b', 'y');
  1331. * $redisCluster->hSet('h', 'c', 'z');
  1332. * $redisCluster->hSet('h', 'd', 't');
  1333. * var_dump($redisCluster->hKeys('h'));
  1334. *
  1335. * //// Output:
  1336. * //
  1337. * // array(4) {
  1338. * // [0]=>
  1339. * // string(1) "a"
  1340. * // [1]=>
  1341. * // string(1) "b"
  1342. * // [2]=>
  1343. * // string(1) "c"
  1344. * // [3]=>
  1345. * // string(1) "d"
  1346. * // }
  1347. * // The order is random and corresponds to redis' own internal representation of the set structure.
  1348. * </pre>
  1349. */
  1350. public function hKeys($key) { }
  1351. /**
  1352. * Returns the values in a hash, as an array of strings.
  1353. *
  1354. * @param string $key
  1355. *
  1356. * @return array An array of elements, the values of the hash. This works like PHP's array_values().
  1357. * @link https://redis.io/commands/hvals
  1358. * @example
  1359. * <pre>
  1360. * $redisCluster->del('h');
  1361. * $redisCluster->hSet('h', 'a', 'x');
  1362. * $redisCluster->hSet('h', 'b', 'y');
  1363. * $redisCluster->hSet('h', 'c', 'z');
  1364. * $redisCluster->hSet('h', 'd', 't');
  1365. * var_dump($redisCluster->hVals('h'));
  1366. *
  1367. * //// Output:
  1368. * //
  1369. * // array(4) {
  1370. * // [0]=>
  1371. * // string(1) "x"
  1372. * // [1]=>
  1373. * // string(1) "y"
  1374. * // [2]=>
  1375. * // string(1) "z"
  1376. * // [3]=>
  1377. * // string(1) "t"
  1378. * // }
  1379. * // The order is random and corresponds to redis' own internal representation of the set structure.
  1380. * </pre>
  1381. */
  1382. public function hVals($key) { }
  1383. /**
  1384. * Gets a value from the hash stored at key.
  1385. * If the hash table doesn't exist, or the key doesn't exist, FALSE is returned.
  1386. *
  1387. * @param string $key
  1388. * @param string $hashKey
  1389. *
  1390. * @return string|false The value, if the command executed successfully BOOL FALSE in case of failure
  1391. * @link https://redis.io/commands/hget
  1392. * @example
  1393. * <pre>
  1394. * $redisCluster->del('h');
  1395. * $redisCluster->hSet('h', 'a', 'x');
  1396. * $redisCluster->hGet('h', 'a'); // 'X'
  1397. * </pre>
  1398. */
  1399. public function hGet($key, $hashKey) { }
  1400. /**
  1401. * Returns the whole hash, as an array of strings indexed by strings.
  1402. *
  1403. * @param string $key
  1404. *
  1405. * @return array An array of elements, the contents of the hash.
  1406. * @link https://redis.io/commands/hgetall
  1407. * @example
  1408. * <pre>
  1409. * $redisCluster->del('h');
  1410. * $redisCluster->hSet('h', 'a', 'x');
  1411. * $redisCluster->hSet('h', 'b', 'y');
  1412. * $redisCluster->hSet('h', 'c', 'z');
  1413. * $redisCluster->hSet('h', 'd', 't');
  1414. * var_dump($redisCluster->hGetAll('h'));
  1415. *
  1416. * //// Output:
  1417. * //
  1418. * // array(4) {
  1419. * // ["a"]=>
  1420. * // string(1) "x"
  1421. * // ["b"]=>
  1422. * // string(1) "y"
  1423. * // ["c"]=>
  1424. * // string(1) "z"
  1425. * // ["d"]=>
  1426. * // string(1) "t"
  1427. * // }
  1428. * // The order is random and corresponds to redis' own internal representation of the set structure.
  1429. * </pre>
  1430. */
  1431. public function hGetAll($key) { }
  1432. /**
  1433. * Verify if the specified member exists in a key.
  1434. *
  1435. * @param string $key
  1436. * @param string $hashKey
  1437. *
  1438. * @return bool If the member exists in the hash table, return TRUE, otherwise return FALSE.
  1439. * @link https://redis.io/commands/hexists
  1440. * @example
  1441. * <pre>
  1442. * $redisCluster->hSet('h', 'a', 'x');
  1443. * $redisCluster->hExists('h', 'a'); // TRUE
  1444. * $redisCluster->hExists('h', 'NonExistingKey'); // FALSE
  1445. * </pre>
  1446. */
  1447. public function hExists($key, $hashKey) { }
  1448. /**
  1449. * Increments the value of a member from a hash by a given amount.
  1450. *
  1451. * @param string $key
  1452. * @param string $hashKey
  1453. * @param int $value (integer) value that will be added to the member's value
  1454. *
  1455. * @return int the new value
  1456. * @link https://redis.io/commands/hincrby
  1457. * @example
  1458. * <pre>
  1459. * $redisCluster->del('h');
  1460. * $redisCluster->hIncrBy('h', 'x', 2); // returns 2: h[x] = 2 now.
  1461. * $redisCluster->hIncrBy('h', 'x', 1); // h[x] ← 2 + 1. Returns 3
  1462. * </pre>
  1463. */
  1464. public function hIncrBy($key, $hashKey, $value) { }
  1465. /**
  1466. * Adds a value to the hash stored at key. If this value is already in the hash, FALSE is returned.
  1467. *
  1468. * @param string $key
  1469. * @param string $hashKey
  1470. * @param string $value
  1471. *
  1472. * @return int
  1473. * 1 if value didn't exist and was added successfully,
  1474. * 0 if the value was already present and was replaced, FALSE if there was an error.
  1475. * @link https://redis.io/commands/hset
  1476. * @example
  1477. * <pre>
  1478. * $redisCluster->del('h')
  1479. * $redisCluster->hSet('h', 'key1', 'hello'); // 1, 'key1' => 'hello' in the hash at "h"
  1480. * $redisCluster->hGet('h', 'key1'); // returns "hello"
  1481. *
  1482. * $redisCluster->hSet('h', 'key1', 'plop'); // 0, value was replaced.
  1483. * $redisCluster->hGet('h', 'key1'); // returns "plop"
  1484. * </pre>
  1485. */
  1486. public function hSet($key, $hashKey, $value) { }
  1487. /**
  1488. * Adds a value to the hash stored at key only if this field isn't already in the hash.
  1489. *
  1490. * @param string $key
  1491. * @param string $hashKey
  1492. * @param string $value
  1493. *
  1494. * @return bool TRUE if the field was set, FALSE if it was already present.
  1495. * @link https://redis.io/commands/hsetnx
  1496. * @example
  1497. * <pre>
  1498. * $redisCluster->del('h')
  1499. * $redisCluster->hSetNx('h', 'key1', 'hello'); // TRUE, 'key1' => 'hello' in the hash at "h"
  1500. * $redisCluster->hSetNx('h', 'key1', 'world'); // FALSE, 'key1' => 'hello' in the hash at "h". No change since the
  1501. * field wasn't replaced.
  1502. * </pre>
  1503. */
  1504. public function hSetNx($key, $hashKey, $value) { }
  1505. /**
  1506. * Retrieve the values associated to the specified fields in the hash.
  1507. *
  1508. * @param string $key
  1509. * @param array $hashKeys
  1510. *
  1511. * @return array Array An array of elements, the values of the specified fields in the hash,
  1512. * with the hash keys as array keys.
  1513. * @link https://redis.io/commands/hmget
  1514. * @example
  1515. * <pre>
  1516. * $redisCluster->del('h');
  1517. * $redisCluster->hSet('h', 'field1', 'value1');
  1518. * $redisCluster->hSet('h', 'field2', 'value2');
  1519. * $redisCluster->hMGet('h', array('field1', 'field2')); // returns array('field1' => 'value1', 'field2' =>
  1520. * 'value2')
  1521. * </pre>
  1522. */
  1523. public function hMGet($key, $hashKeys) { }
  1524. /**
  1525. * Fills in a whole hash. Non-string values are converted to string, using the standard (string) cast.
  1526. * NULL values are stored as empty strings
  1527. *
  1528. * @param string $key
  1529. * @param array $hashKeys key → value array
  1530. *
  1531. * @return bool
  1532. * @link https://redis.io/commands/hmset
  1533. * @example
  1534. * <pre>
  1535. * $redisCluster->del('user:1');
  1536. * $redisCluster->hMSet('user:1', array('name' => 'Joe', 'salary' => 2000));
  1537. * $redisCluster->hIncrBy('user:1', 'salary', 100); // Joe earns 100 more now.
  1538. * </pre>
  1539. */
  1540. public function hMSet($key, $hashKeys) { }
  1541. /**
  1542. * Removes a values from the hash stored at key.
  1543. * If the hash table doesn't exist, or the key doesn't exist, FALSE is returned.
  1544. *
  1545. * @param string $key
  1546. * @param string $hashKey1
  1547. * @param string $hashKey2
  1548. * @param string $hashKeyN
  1549. *
  1550. * @return int Number of deleted fields
  1551. * @link https://redis.io/commands/hdel
  1552. * @example
  1553. * <pre>
  1554. * $redisCluster->hMSet('h',
  1555. * array(
  1556. * 'f1' => 'v1',
  1557. * 'f2' => 'v2',
  1558. * 'f3' => 'v3',
  1559. * 'f4' => 'v4',
  1560. * ));
  1561. *
  1562. * var_dump( $redisCluster->hDel('h', 'f1') ); // int(1)
  1563. * var_dump( $redisCluster->hDel('h', 'f2', 'f3') ); // int(2)
  1564. *
  1565. * var_dump( $redisCluster->hGetAll('h') );
  1566. *
  1567. * //// Output:
  1568. * //
  1569. * // array(1) {
  1570. * // ["f4"]=> string(2) "v4"
  1571. * // }
  1572. * </pre>
  1573. */
  1574. public function hDel($key, $hashKey1, $hashKey2 = null, $hashKeyN = null) { }
  1575. /**
  1576. * Increment the float value of a hash field by the given amount
  1577. *
  1578. * @param string $key
  1579. * @param string $field
  1580. * @param float $increment
  1581. *
  1582. * @return float
  1583. * @link https://redis.io/commands/hincrbyfloat
  1584. * @example
  1585. * <pre>
  1586. * $redisCluster->hset('h', 'float', 3);
  1587. * $redisCluster->hset('h', 'int', 3);
  1588. * var_dump( $redisCluster->hIncrByFloat('h', 'float', 1.5) ); // float(4.5)
  1589. *
  1590. * var_dump( $redisCluster->hGetAll('h') );
  1591. *
  1592. * //// Output:
  1593. * //
  1594. * // array(2) {
  1595. * // ["float"]=>
  1596. * // string(3) "4.5"
  1597. * // ["int"]=>
  1598. * // string(1) "3"
  1599. * // }
  1600. * </pre>
  1601. */
  1602. public function hIncrByFloat($key, $field, $increment) { }
  1603. /**
  1604. * Dump a key out of a redis database, the value of which can later be passed into redis using the RESTORE command.
  1605. * The data that comes out of DUMP is a binary representation of the key as Redis stores it.
  1606. *
  1607. * @param string $key
  1608. *
  1609. * @return string|false The Redis encoded value of the key, or FALSE if the key doesn't exist
  1610. * @link https://redis.io/commands/dump
  1611. * @example
  1612. * <pre>
  1613. * $redisCluster->set('foo', 'bar');
  1614. * $val = $redisCluster->dump('foo'); // $val will be the Redis encoded key value
  1615. * </pre>
  1616. */
  1617. public function dump($key) { }
  1618. /**
  1619. * Returns the rank of a given member in the specified sorted set, starting at 0 for the item
  1620. * with the smallest score. zRevRank starts at 0 for the item with the largest score.
  1621. *
  1622. * @param string $key
  1623. * @param string $member
  1624. *
  1625. * @return int the item's score.
  1626. * @link https://redis.io/commands/zrank
  1627. * @example
  1628. * <pre>
  1629. * $redisCluster->del('z');
  1630. * $redisCluster->zAdd('key', 1, 'one');
  1631. * $redisCluster->zAdd('key', 2, 'two');
  1632. * $redisCluster->zRank('key', 'one'); // 0
  1633. * $redisCluster->zRank('key', 'two'); // 1
  1634. * $redisCluster->zRevRank('key', 'one'); // 1
  1635. * $redisCluster->zRevRank('key', 'two'); // 0
  1636. * </pre>
  1637. */
  1638. public function zRank($key, $member) { }
  1639. /**
  1640. * @see zRank()
  1641. *
  1642. * @param string $key
  1643. * @param string $member
  1644. *
  1645. * @return int the item's score
  1646. * @link https://redis.io/commands/zrevrank
  1647. */
  1648. public function zRevRank($key, $member) { }
  1649. /**
  1650. * Increment the number stored at key by one.
  1651. *
  1652. * @param string $key
  1653. *
  1654. * @return int the new value
  1655. * @link https://redis.io/commands/incr
  1656. * @example
  1657. * <pre>
  1658. * $redisCluster->incr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value 1
  1659. * $redisCluster->incr('key1'); // 2
  1660. * $redisCluster->incr('key1'); // 3
  1661. * $redisCluster->incr('key1'); // 4
  1662. * </pre>
  1663. */
  1664. public function incr($key) { }
  1665. /**
  1666. * Decrement the number stored at key by one.
  1667. *
  1668. * @param string $key
  1669. *
  1670. * @return int the new value
  1671. * @link https://redis.io/commands/decr
  1672. * @example
  1673. * <pre>
  1674. * $redisCluster->decr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value -1
  1675. * $redisCluster->decr('key1'); // -2
  1676. * $redisCluster->decr('key1'); // -3
  1677. * </pre>
  1678. */
  1679. public function decr($key) { }
  1680. /**
  1681. * Increment the number stored at key by one. If the second argument is filled, it will be used as the integer
  1682. * value of the increment.
  1683. *
  1684. * @param string $key key
  1685. * @param int $value value that will be added to key (only for incrBy)
  1686. *
  1687. * @return int the new value
  1688. * @link https://redis.io/commands/incrby
  1689. * @example
  1690. * <pre>
  1691. * $redisCluster->incr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value 1
  1692. * $redisCluster->incr('key1'); // 2
  1693. * $redisCluster->incr('key1'); // 3
  1694. * $redisCluster->incr('key1'); // 4
  1695. * $redisCluster->incrBy('key1', 10); // 14
  1696. * </pre>
  1697. */
  1698. public function incrBy($key, $value) { }
  1699. /**
  1700. * Decrement the number stored at key by one. If the second argument is filled, it will be used as the integer
  1701. * value of the decrement.
  1702. *
  1703. * @param string $key
  1704. * @param int $value that will be subtracted to key (only for decrBy)
  1705. *
  1706. * @return int the new value
  1707. * @link https://redis.io/commands/decrby
  1708. * @example
  1709. * <pre>
  1710. * $redisCluster->decr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value -1
  1711. * $redisCluster->decr('key1'); // -2
  1712. * $redisCluster->decr('key1'); // -3
  1713. * $redisCluster->decrBy('key1', 10); // -13
  1714. * </pre>
  1715. */
  1716. public function decrBy($key, $value) { }
  1717. /**
  1718. * Increment the float value of a key by the given amount
  1719. *
  1720. * @param string $key
  1721. * @param float $increment
  1722. *
  1723. * @return float
  1724. * @link https://redis.io/commands/incrbyfloat
  1725. * @example
  1726. * <pre>
  1727. * $redisCluster->set('x', 3);
  1728. * var_dump( $redisCluster->incrByFloat('x', 1.5) ); // float(4.5)
  1729. *
  1730. * var_dump( $redisCluster->get('x') ); // string(3) "4.5"
  1731. * </pre>
  1732. */
  1733. public function incrByFloat($key, $increment) { }
  1734. /**
  1735. * Sets an expiration date (a timeout) on an item.
  1736. *
  1737. * @param string $key The key that will disappear.
  1738. * @param int $ttl The key's remaining Time To Live, in seconds.
  1739. *
  1740. * @return bool TRUE in case of success, FALSE in case of failure.
  1741. * @link https://redis.io/commands/expire
  1742. * @example
  1743. * <pre>
  1744. * $redisCluster->set('x', '42');
  1745. * $redisCluster->expire('x', 3); // x will disappear in 3 seconds.
  1746. * sleep(5); // wait 5 seconds
  1747. * $redisCluster->get('x'); // will return `FALSE`, as 'x' has expired.
  1748. * </pre>
  1749. */
  1750. public function expire($key, $ttl) { }
  1751. /**
  1752. * Sets an expiration date (a timeout in milliseconds) on an item.
  1753. *
  1754. * @param string $key The key that will disappear.
  1755. * @param int $ttl The key's remaining Time To Live, in milliseconds.
  1756. *
  1757. * @return bool TRUE in case of success, FALSE in case of failure.
  1758. * @link https://redis.io/commands/pexpire
  1759. * @example
  1760. * <pre>
  1761. * $redisCluster->set('x', '42');
  1762. * $redisCluster->pExpire('x', 11500); // x will disappear in 11500 milliseconds.
  1763. * $redisCluster->ttl('x'); // 12
  1764. * $redisCluster->pttl('x'); // 11500
  1765. * </pre>
  1766. */
  1767. public function pExpire($key, $ttl) { }
  1768. /**
  1769. * Sets an expiration date (a timestamp) on an item.
  1770. *
  1771. * @param string $key The key that will disappear.
  1772. * @param int $timestamp Unix timestamp. The key's date of death, in seconds from Epoch time.
  1773. *
  1774. * @return bool TRUE in case of success, FALSE in case of failure.
  1775. * @link https://redis.io/commands/expireat
  1776. * @example
  1777. * <pre>
  1778. * $redisCluster->set('x', '42');
  1779. * $now = time(); // current timestamp
  1780. * $redisCluster->expireAt('x', $now + 3); // x will disappear in 3 seconds.
  1781. * sleep(5); // wait 5 seconds
  1782. * $redisCluster->get('x'); // will return `FALSE`, as 'x' has expired.
  1783. * </pre>
  1784. */
  1785. public function expireAt($key, $timestamp) { }
  1786. /**
  1787. * Sets an expiration date (a timestamp) on an item. Requires a timestamp in milliseconds
  1788. *
  1789. * @param string $key The key that will disappear.
  1790. * @param int $timestamp Unix timestamp. The key's date of death, in seconds from Epoch time.
  1791. *
  1792. * @return bool TRUE in case of success, FALSE in case of failure.
  1793. * @link https://redis.io/commands/pexpireat
  1794. * @example
  1795. * <pre>
  1796. * $redisCluster->set('x', '42');
  1797. * $redisCluster->pExpireAt('x', 1555555555005);
  1798. * $redisCluster->ttl('x'); // 218270121
  1799. * $redisCluster->pttl('x'); // 218270120575
  1800. * </pre>
  1801. */
  1802. public function pExpireAt($key, $timestamp) { }
  1803. /**
  1804. * Append specified string to the string stored in specified key.
  1805. *
  1806. * @param string $key
  1807. * @param string $value
  1808. *
  1809. * @return int Size of the value after the append
  1810. * @link https://redis.io/commands/append
  1811. * @example
  1812. * <pre>
  1813. * $redisCluster->set('key', 'value1');
  1814. * $redisCluster->append('key', 'value2'); // 12
  1815. * $redisCluster->get('key'); // 'value1value2'
  1816. * </pre>
  1817. */
  1818. public function append($key, $value) { }
  1819. /**
  1820. * Return a single bit out of a larger string
  1821. *
  1822. * @param string $key
  1823. * @param int $offset
  1824. *
  1825. * @return int the bit value (0 or 1)
  1826. * @link https://redis.io/commands/getbit
  1827. * @example
  1828. * <pre>
  1829. * $redisCluster->set('key', "\x7f"); // this is 0111 1111
  1830. * $redisCluster->getBit('key', 0); // 0
  1831. * $redisCluster->getBit('key', 1); // 1
  1832. * </pre>
  1833. */
  1834. public function getBit($key, $offset) { }
  1835. /**
  1836. * Changes a single bit of a string.
  1837. *
  1838. * @param string $key
  1839. * @param int $offset
  1840. * @param bool|int $value bool or int (1 or 0)
  1841. *
  1842. * @return int 0 or 1, the value of the bit before it was set.
  1843. * @link https://redis.io/commands/setbit
  1844. * @example
  1845. * <pre>
  1846. * $redisCluster->set('key', "*"); // ord("*") = 42 = 0x2f = "0010 1010"
  1847. * $redisCluster->setBit('key', 5, 1); // returns 0
  1848. * $redisCluster->setBit('key', 7, 1); // returns 0
  1849. * $redisCluster->get('key'); // chr(0x2f) = "/" = b("0010 1111")
  1850. * </pre>
  1851. */
  1852. public function setBit($key, $offset, $value) { }
  1853. /**
  1854. * Bitwise operation on multiple keys.
  1855. *
  1856. * @param string $operation either "AND", "OR", "NOT", "XOR"
  1857. * @param string $retKey return key
  1858. * @param string $key1
  1859. * @param string $key2
  1860. * @param string $key3
  1861. *
  1862. * @return int The size of the string stored in the destination key.
  1863. * @link https://redis.io/commands/bitop
  1864. * @example
  1865. * <pre>
  1866. * $redisCluster->set('bit1', '1'); // 11 0001
  1867. * $redisCluster->set('bit2', '2'); // 11 0010
  1868. *
  1869. * $redisCluster->bitOp('AND', 'bit', 'bit1', 'bit2'); // bit = 110000
  1870. * $redisCluster->bitOp('OR', 'bit', 'bit1', 'bit2'); // bit = 110011
  1871. * $redisCluster->bitOp('NOT', 'bit', 'bit1', 'bit2'); // bit = 110011
  1872. * $redisCluster->bitOp('XOR', 'bit', 'bit1', 'bit2'); // bit = 11
  1873. * </pre>
  1874. */
  1875. public function bitOp($operation, $retKey, $key1, $key2, $key3 = null) { }
  1876. /**
  1877. * Return the position of the first bit set to 1 or 0 in a string. The position is returned, thinking of the
  1878. * string as an array of bits from left to right, where the first byte's most significant bit is at position 0,
  1879. * the second byte's most significant bit is at position 8, and so forth.
  1880. *
  1881. * @param string $key
  1882. * @param int $bit
  1883. * @param int $start
  1884. * @param int $end
  1885. *
  1886. * @return int The command returns the position of the first bit set to 1 or 0 according to the request.
  1887. * If we look for set bits (the bit argument is 1) and the string is empty or composed of just
  1888. * zero bytes, -1 is returned. If we look for clear bits (the bit argument is 0) and the string
  1889. * only contains bit set to 1, the function returns the first bit not part of the string on the
  1890. * right. So if the string is three bytes set to the value 0xff the command BITPOS key 0 will
  1891. * return 24, since up to bit 23 all the bits are 1. Basically, the function considers the right
  1892. * of the string as padded with zeros if you look for clear bits and specify no range or the
  1893. * start argument only. However, this behavior changes if you are looking for clear bits and
  1894. * specify a range with both start and end. If no clear bit is found in the specified range, the
  1895. * function returns -1 as the user specified a clear range and there are no 0 bits in that range.
  1896. * @link https://redis.io/commands/bitpos
  1897. * @example
  1898. * <pre>
  1899. * $redisCluster->set('key', '\xff\xff');
  1900. * $redisCluster->bitpos('key', 1); // int(0)
  1901. * $redisCluster->bitpos('key', 1, 1); // int(8)
  1902. * $redisCluster->bitpos('key', 1, 3); // int(-1)
  1903. * $redisCluster->bitpos('key', 0); // int(16)
  1904. * $redisCluster->bitpos('key', 0, 1); // int(16)
  1905. * $redisCluster->bitpos('key', 0, 1, 5); // int(-1)
  1906. * </pre>
  1907. */
  1908. public function bitpos($key, $bit, $start = 0, $end = null) { }
  1909. /**
  1910. * Count bits in a string.
  1911. *
  1912. * @param string $key
  1913. *
  1914. * @return int The number of bits set to 1 in the value behind the input key.
  1915. * @link https://redis.io/commands/bitcount
  1916. * @example
  1917. * <pre>
  1918. * $redisCluster->set('bit', '345'); // // 11 0011 0011 0100 0011 0101
  1919. * var_dump( $redisCluster->bitCount('bit', 0, 0) ); // int(4)
  1920. * var_dump( $redisCluster->bitCount('bit', 1, 1) ); // int(3)
  1921. * var_dump( $redisCluster->bitCount('bit', 2, 2) ); // int(4)
  1922. * var_dump( $redisCluster->bitCount('bit', 0, 2) ); // int(11)
  1923. * </pre>
  1924. */
  1925. public function bitCount($key) { }
  1926. /**
  1927. * @see lIndex()
  1928. *
  1929. * @param string $key
  1930. * @param int $index
  1931. *
  1932. * @link https://redis.io/commands/lindex
  1933. */
  1934. public function lGet($key, $index) { }
  1935. /**
  1936. * Return a substring of a larger string
  1937. *
  1938. * @param string $key
  1939. * @param int $start
  1940. * @param int $end
  1941. *
  1942. * @return string the substring
  1943. * @link https://redis.io/commands/getrange
  1944. * @example
  1945. * <pre>
  1946. * $redisCluster->set('key', 'string value');
  1947. * $redisCluster->getRange('key', 0, 5); // 'string'
  1948. * $redisCluster->getRange('key', -5, -1); // 'value'
  1949. * </pre>
  1950. */
  1951. public function getRange($key, $start, $end) { }
  1952. /**
  1953. * Trims an existing list so that it will contain only a specified range of elements.
  1954. *
  1955. * @param string $key
  1956. * @param int $start
  1957. * @param int $stop
  1958. *
  1959. * @return array|false Bool return FALSE if the key identify a non-list value.
  1960. * @link https://redis.io/commands/ltrim
  1961. * @example
  1962. * <pre>
  1963. * $redisCluster->rPush('key1', 'A');
  1964. * $redisCluster->rPush('key1', 'B');
  1965. * $redisCluster->rPush('key1', 'C');
  1966. * $redisCluster->lRange('key1', 0, -1); // array('A', 'B', 'C')
  1967. * $redisCluster->lTrim('key1', 0, 1);
  1968. * $redisCluster->lRange('key1', 0, -1); // array('A', 'B')
  1969. * </pre>
  1970. */
  1971. public function lTrim($key, $start, $stop) { }
  1972. /**
  1973. * Returns the specified elements of the list stored at the specified key in
  1974. * the range [start, end]. start and stop are interpretated as indices: 0 the first element,
  1975. * 1 the second ... -1 the last element, -2 the penultimate ...
  1976. *
  1977. * @param string $key
  1978. * @param int $start
  1979. * @param int $end
  1980. *
  1981. * @return array containing the values in specified range.
  1982. * @link https://redis.io/commands/lrange
  1983. * @example
  1984. * <pre>
  1985. * $redisCluster->rPush('key1', 'A');
  1986. * $redisCluster->rPush('key1', 'B');
  1987. * $redisCluster->rPush('key1', 'C');
  1988. * $redisCluster->lRange('key1', 0, -1); // array('A', 'B', 'C')
  1989. * </pre>
  1990. */
  1991. public function lRange($key, $start, $end) { }
  1992. /**
  1993. * Deletes the elements of the sorted set stored at the specified key which have rank in the range [start,end].
  1994. *
  1995. * @param string $key
  1996. * @param int $start
  1997. * @param int $end
  1998. *
  1999. * @return int The number of values deleted from the sorted set
  2000. * @link https://redis.io/commands/zremrangebyrank
  2001. * @example
  2002. * <pre>
  2003. * $redisCluster->zAdd('key', 1, 'one');
  2004. * $redisCluster->zAdd('key', 2, 'two');
  2005. * $redisCluster->zAdd('key', 3, 'three');
  2006. * $redisCluster->zRemRangeByRank('key', 0, 1); // 2
  2007. * $redisCluster->zRange('key', 0, -1, true); // array('three' => 3)
  2008. * </pre>
  2009. */
  2010. public function zRemRangeByRank($key, $start, $end) { }
  2011. /**
  2012. * Publish messages to channels. Warning: this function will probably change in the future.
  2013. *
  2014. * @param string $channel a channel to publish to
  2015. * @param string $message string
  2016. *
  2017. * @link https://redis.io/commands/publish
  2018. * @return int Number of clients that received the message
  2019. * @example $redisCluster->publish('chan-1', 'hello, world!'); // send message.
  2020. */
  2021. public function publish($channel, $message) { }
  2022. /**
  2023. * Renames a key.
  2024. *
  2025. * @param string $srcKey
  2026. * @param string $dstKey
  2027. *
  2028. * @return bool TRUE in case of success, FALSE in case of failure.
  2029. * @link https://redis.io/commands/rename
  2030. * @example
  2031. * <pre>
  2032. * $redisCluster->set('x', '42');
  2033. * $redisCluster->rename('x', 'y');
  2034. * $redisCluster->get('y'); // → 42
  2035. * $redisCluster->get('x'); // → `FALSE`
  2036. * </pre>
  2037. */
  2038. public function rename($srcKey, $dstKey) { }
  2039. /**
  2040. * Renames a key.
  2041. *
  2042. * Same as rename, but will not replace a key if the destination already exists.
  2043. * This is the same behaviour as setNx.
  2044. *
  2045. * @param string $srcKey
  2046. * @param string $dstKey
  2047. *
  2048. * @return bool TRUE in case of success, FALSE in case of failure.
  2049. * @link https://redis.io/commands/renamenx
  2050. * @example
  2051. * <pre>
  2052. * $redisCluster->set('x', '42');
  2053. * $redisCluster->renameNx('x', 'y');
  2054. * $redisCluster->get('y'); // → 42
  2055. * $redisCluster->get('x'); // → `FALSE`
  2056. * </pre>
  2057. */
  2058. public function renameNx($srcKey, $dstKey) { }
  2059. /**
  2060. * When called with a single key, returns the approximated cardinality computed by the HyperLogLog data
  2061. * structure stored at the specified variable, which is 0 if the variable does not exist.
  2062. *
  2063. * @param string|array $key
  2064. *
  2065. * @return int
  2066. * @link https://redis.io/commands/pfcount
  2067. * @example
  2068. * <pre>
  2069. * $redisCluster->pfAdd('key1', array('elem1', 'elem2'));
  2070. * $redisCluster->pfAdd('key2', array('elem3', 'elem2'));
  2071. * $redisCluster->pfCount('key1'); // int(2)
  2072. * $redisCluster->pfCount(array('key1', 'key2')); // int(3)
  2073. * </pre>
  2074. */
  2075. public function pfCount($key) { }
  2076. /**
  2077. * Adds all the element arguments to the HyperLogLog data structure stored at the key.
  2078. *
  2079. * @param string $key
  2080. * @param array $elements
  2081. *
  2082. * @return bool
  2083. * @link https://redis.io/commands/pfadd
  2084. * @example $redisCluster->pfAdd('key', array('elem1', 'elem2'))
  2085. */
  2086. public function pfAdd($key, array $elements) { }
  2087. /**
  2088. * Merge multiple HyperLogLog values into an unique value that will approximate the cardinality
  2089. * of the union of the observed Sets of the source HyperLogLog structures.
  2090. *
  2091. * @param string $destKey
  2092. * @param array $sourceKeys
  2093. *
  2094. * @return bool
  2095. * @link https://redis.io/commands/pfmerge
  2096. * @example
  2097. * <pre>
  2098. * $redisCluster->pfAdd('key1', array('elem1', 'elem2'));
  2099. * $redisCluster->pfAdd('key2', array('elem3', 'elem2'));
  2100. * $redisCluster->pfMerge('key3', array('key1', 'key2'));
  2101. * $redisCluster->pfCount('key3'); // int(3)
  2102. * </pre>
  2103. */
  2104. public function pfMerge($destKey, array $sourceKeys) { }
  2105. /**
  2106. * Changes a substring of a larger string.
  2107. *
  2108. * @param string $key
  2109. * @param int $offset
  2110. * @param string $value
  2111. *
  2112. * @return string the length of the string after it was modified.
  2113. * @link https://redis.io/commands/setrange
  2114. * @example
  2115. * <pre>
  2116. * $redisCluster->set('key', 'Hello world');
  2117. * $redisCluster->setRange('key', 6, "redis"); // returns 11
  2118. * $redisCluster->get('key'); // "Hello redis"
  2119. * </pre>
  2120. */
  2121. public function setRange($key, $offset, $value) { }
  2122. /**
  2123. * Restore a key from the result of a DUMP operation.
  2124. *
  2125. * @param string $key The key name
  2126. * @param int $ttl How long the key should live (if zero, no expire will be set on the key)
  2127. * @param string $value (binary). The Redis encoded key value (from DUMP)
  2128. *
  2129. * @return bool
  2130. * @link https://redis.io/commands/restore
  2131. * @example
  2132. * <pre>
  2133. * $redisCluster->set('foo', 'bar');
  2134. * $val = $redisCluster->dump('foo');
  2135. * $redisCluster->restore('bar', 0, $val); // The key 'bar', will now be equal to the key 'foo'
  2136. * </pre>
  2137. */
  2138. public function restore($key, $ttl, $value) { }
  2139. /**
  2140. * Moves the specified member from the set at srcKey to the set at dstKey.
  2141. *
  2142. * @param string $srcKey
  2143. * @param string $dstKey
  2144. * @param string $member
  2145. *
  2146. * @return bool If the operation is successful, return TRUE.
  2147. * If the srcKey and/or dstKey didn't exist, and/or the member didn't exist in srcKey, FALSE is returned.
  2148. * @link https://redis.io/commands/smove
  2149. * @example
  2150. * <pre>
  2151. * $redisCluster->sAdd('key1' , 'set11');
  2152. * $redisCluster->sAdd('key1' , 'set12');
  2153. * $redisCluster->sAdd('key1' , 'set13'); // 'key1' => {'set11', 'set12', 'set13'}
  2154. * $redisCluster->sAdd('key2' , 'set21');
  2155. * $redisCluster->sAdd('key2' , 'set22'); // 'key2' => {'set21', 'set22'}
  2156. * $redisCluster->sMove('key1', 'key2', 'set13'); // 'key1' => {'set11', 'set12'}
  2157. * // 'key2' => {'set21', 'set22', 'set13'}
  2158. * </pre>
  2159. */
  2160. public function sMove($srcKey, $dstKey, $member) { }
  2161. /**
  2162. * Returns a range of elements from the ordered set stored at the specified key,
  2163. * with values in the range [start, end]. start and stop are interpreted as zero-based indices:
  2164. * 0 the first element,
  2165. * 1 the second ...
  2166. * -1 the last element,
  2167. * -2 the penultimate ...
  2168. *
  2169. * @param string $key
  2170. * @param int $start
  2171. * @param int $end
  2172. * @param bool $withscores
  2173. *
  2174. * @return array Array containing the values in specified range.
  2175. * @link https://redis.io/commands/zrange
  2176. * @example
  2177. * <pre>
  2178. * $redisCluster->zAdd('key1', 0, 'val0');
  2179. * $redisCluster->zAdd('key1', 2, 'val2');
  2180. * $redisCluster->zAdd('key1', 10, 'val10');
  2181. * $redisCluster->zRange('key1', 0, -1); // array('val0', 'val2', 'val10')
  2182. * // with scores
  2183. * $redisCluster->zRange('key1', 0, -1, true); // array('val0' => 0, 'val2' => 2, 'val10' => 10)
  2184. * </pre>
  2185. */
  2186. public function zRange($key, $start, $end, $withscores = null) { }
  2187. /**
  2188. * Returns the elements of the sorted set stored at the specified key in the range [start, end]
  2189. * in reverse order. start and stop are interpretated as zero-based indices:
  2190. * 0 the first element,
  2191. * 1 the second ...
  2192. * -1 the last element,
  2193. * -2 the penultimate ...
  2194. *
  2195. * @param string $key
  2196. * @param int $start
  2197. * @param int $end
  2198. * @param bool $withscore
  2199. *
  2200. * @return array Array containing the values in specified range.
  2201. * @link https://redis.io/commands/zrevrange
  2202. * @example
  2203. * <pre>
  2204. * $redisCluster->zAdd('key', 0, 'val0');
  2205. * $redisCluster->zAdd('key', 2, 'val2');
  2206. * $redisCluster->zAdd('key', 10, 'val10');
  2207. * $redisCluster->zRevRange('key', 0, -1); // array('val10', 'val2', 'val0')
  2208. *
  2209. * // with scores
  2210. * $redisCluster->zRevRange('key', 0, -1, true); // array('val10' => 10, 'val2' => 2, 'val0' => 0)
  2211. * </pre>
  2212. */
  2213. public function zRevRange($key, $start, $end, $withscore = null) { }
  2214. /**
  2215. * Returns the elements of the sorted set stored at the specified key which have scores in the
  2216. * range [start,end]. Adding a parenthesis before start or end excludes it from the range.
  2217. * +inf and -inf are also valid limits.
  2218. *
  2219. * zRevRangeByScore returns the same items in reverse order, when the start and end parameters are swapped.
  2220. *
  2221. * @param string $key
  2222. * @param int $start
  2223. * @param int $end
  2224. * @param array $options Two options are available:
  2225. * - withscores => TRUE,
  2226. * - and limit => array($offset, $count)
  2227. *
  2228. * @return array Array containing the values in specified range.
  2229. * @link https://redis.io/commands/zrangebyscore
  2230. * @example
  2231. * <pre>
  2232. * $redisCluster->zAdd('key', 0, 'val0');
  2233. * $redisCluster->zAdd('key', 2, 'val2');
  2234. * $redisCluster->zAdd('key', 10, 'val10');
  2235. * $redisCluster->zRangeByScore('key', 0, 3);
  2236. * // array('val0', 'val2')
  2237. * $redisCluster->zRangeByScore('key', 0, 3, array('withscores' => TRUE);
  2238. * // array('val0' => 0, 'val2' => 2)
  2239. * $redisCluster->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));
  2240. * // array('val2' => 2)
  2241. * $redisCluster->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));
  2242. * // array('val2')
  2243. * $redisCluster->zRangeByScore('key', 0, 3, array('withscores' => TRUE, 'limit' => array(1, 1));
  2244. * // array('val2'=> 2)
  2245. * </pre>
  2246. */
  2247. public function zRangeByScore($key, $start, $end, array $options = array()) { }
  2248. /**
  2249. * @see zRangeByScore()
  2250. *
  2251. * @param string $key
  2252. * @param int $start
  2253. * @param int $end
  2254. * @param array $options
  2255. *
  2256. * @return array
  2257. */
  2258. public function zRevRangeByScore($key, $start, $end, array $options = array()) { }
  2259. /**
  2260. * Returns a range of members in a sorted set, by lexicographical range
  2261. *
  2262. * @param string $key The ZSET you wish to run against.
  2263. * @param int $min The minimum alphanumeric value you wish to get.
  2264. * @param int $max The maximum alphanumeric value you wish to get.
  2265. * @param int $offset Optional argument if you wish to start somewhere other than the first element.
  2266. * @param int $limit Optional argument if you wish to limit the number of elements returned.
  2267. *
  2268. * @return array Array containing the values in the specified range.
  2269. * @link https://redis.io/commands/zrangebylex
  2270. * @example
  2271. * <pre>
  2272. * foreach (array('a', 'b', 'c', 'd', 'e', 'f', 'g') as $k => $char) {
  2273. * $redisCluster->zAdd('key', $k, $char);
  2274. * }
  2275. *
  2276. * $redisCluster->zRangeByLex('key', '-', '[c'); // array('a', 'b', 'c')
  2277. * $redisCluster->zRangeByLex('key', '-', '(c'); // array('a', 'b')
  2278. * $redisCluster->zRevRangeByLex('key', '(c','-'); // array('b', 'a')
  2279. * </pre>
  2280. */
  2281. public function zRangeByLex($key, $min, $max, $offset = null, $limit = null) { }
  2282. /**
  2283. * @see zRangeByLex()
  2284. *
  2285. * @param string $key
  2286. * @param int $min
  2287. * @param int $max
  2288. * @param int $offset
  2289. * @param int $limit
  2290. *
  2291. * @return array
  2292. * @link https://redis.io/commands/zrevrangebylex
  2293. */
  2294. public function zRevRangeByLex($key, $min, $max, $offset = null, $limit = null) { }
  2295. /**
  2296. * Count the number of members in a sorted set between a given lexicographical range.
  2297. *
  2298. * @param string $key
  2299. * @param int $min
  2300. * @param int $max
  2301. *
  2302. * @return int The number of elements in the specified score range.
  2303. * @link https://redis.io/commands/zlexcount
  2304. * @example
  2305. * <pre>
  2306. * foreach (array('a', 'b', 'c', 'd', 'e', 'f', 'g') as $k => $char) {
  2307. * $redisCluster->zAdd('key', $k, $char);
  2308. * }
  2309. * $redisCluster->zLexCount('key', '[b', '[f'); // 5
  2310. * </pre>
  2311. */
  2312. public function zLexCount($key, $min, $max) { }
  2313. /**
  2314. * Remove all members in a sorted set between the given lexicographical range.
  2315. *
  2316. * @param string $key The ZSET you wish to run against.
  2317. * @param int $min The minimum alphanumeric value you wish to get.
  2318. * @param int $max The maximum alphanumeric value you wish to get.
  2319. *
  2320. * @return array the number of elements removed.
  2321. * @link https://redis.io/commands/zremrangebylex
  2322. * @example
  2323. * <pre>
  2324. * foreach (array('a', 'b', 'c', 'd', 'e', 'f', 'g') as $k => $char) {
  2325. * $redisCluster->zAdd('key', $k, $char);
  2326. * }
  2327. * $redisCluster->zRemRangeByLex('key', '(b','[d'); // 2 , remove element 'c' and 'd'
  2328. * $redisCluster->zRange('key',0,-1);// array('a','b','e','f','g')
  2329. * </pre>
  2330. */
  2331. public function zRemRangeByLex($key, $min, $max) {
  2332. }
  2333. /**
  2334. * Add multiple sorted sets and store the resulting sorted set in a new key
  2335. *
  2336. * @param string $Output
  2337. * @param array $ZSetKeys
  2338. * @param null|array $Weights
  2339. * @param string $aggregateFunction Either "SUM", "MIN", or "MAX": defines the behaviour to use on
  2340. * duplicate entries during the zUnion.
  2341. *
  2342. * @return int The number of values in the new sorted set.
  2343. * @link https://redis.io/commands/zunionstore
  2344. * @example
  2345. * <pre>
  2346. * $redisCluster->del('k1');
  2347. * $redisCluster->del('k2');
  2348. * $redisCluster->del('k3');
  2349. * $redisCluster->del('ko1');
  2350. * $redisCluster->del('ko2');
  2351. * $redisCluster->del('ko3');
  2352. *
  2353. * $redisCluster->zAdd('k1', 0, 'val0');
  2354. * $redisCluster->zAdd('k1', 1, 'val1');
  2355. *
  2356. * $redisCluster->zAdd('k2', 2, 'val2');
  2357. * $redisCluster->zAdd('k2', 3, 'val3');
  2358. *
  2359. * $redisCluster->zUnionStore('ko1', array('k1', 'k2')); // 4, 'ko1' => array('val0', 'val1', 'val2', 'val3')
  2360. *
  2361. * // Weighted zUnionStore
  2362. * $redisCluster->zUnionStore('ko2', array('k1', 'k2'), array(1, 1)); // 4, 'ko2' => array('val0', 'val1', 'val2','val3')
  2363. * $redisCluster->zUnionStore('ko3', array('k1', 'k2'), array(5, 1)); // 4, 'ko3' => array('val0', 'val2', 'val3','val1')
  2364. * </pre>
  2365. */
  2366. public function zUnionStore($Output, $ZSetKeys, ?array $Weights = null, $aggregateFunction = 'SUM') { }
  2367. /**
  2368. * Intersect multiple sorted sets and store the resulting sorted set in a new key
  2369. *
  2370. * @param string $Output
  2371. * @param array $ZSetKeys
  2372. * @param null|array $Weights
  2373. * @param string $aggregateFunction Either "SUM", "MIN", or "MAX":
  2374. * defines the behaviour to use on duplicate entries during the zInterStore.
  2375. *
  2376. * @return int The number of values in the new sorted set.
  2377. * @link https://redis.io/commands/zinterstore
  2378. * @example
  2379. * <pre>
  2380. * $redisCluster->del('k1');
  2381. * $redisCluster->del('k2');
  2382. * $redisCluster->del('k3');
  2383. *
  2384. * $redisCluster->del('ko1');
  2385. * $redisCluster->del('ko2');
  2386. * $redisCluster->del('ko3');
  2387. * $redisCluster->del('ko4');
  2388. *
  2389. * $redisCluster->zAdd('k1', 0, 'val0');
  2390. * $redisCluster->zAdd('k1', 1, 'val1');
  2391. * $redisCluster->zAdd('k1', 3, 'val3');
  2392. *
  2393. * $redisCluster->zAdd('k2', 2, 'val1');
  2394. * $redisCluster->zAdd('k2', 3, 'val3');
  2395. *
  2396. * $redisCluster->zInterStore('ko1', array('k1', 'k2')); // 2, 'ko1' => array('val1', 'val3')
  2397. * $redisCluster->zInterStore('ko2', array('k1', 'k2'), array(1, 1)); // 2, 'ko2' => array('val1', 'val3')
  2398. *
  2399. * // Weighted zInterStore
  2400. * $redisCluster->zInterStore('ko3', array('k1', 'k2'), array(1, 5), 'min'); // 2, 'ko3' => array('val1', 'val3')
  2401. * $redisCluster->zInterStore('ko4', array('k1', 'k2'), array(1, 5), 'max'); // 2, 'ko4' => array('val3', 'val1')
  2402. * </pre>
  2403. */
  2404. public function zInterStore($Output, $ZSetKeys, array $Weights = null, $aggregateFunction = 'SUM') { }
  2405. /**
  2406. * Deletes a specified member from the ordered set.
  2407. *
  2408. * @param string $key
  2409. * @param string $member1
  2410. * @param string $member2
  2411. * @param string $memberN
  2412. *
  2413. * @return int Number of deleted values
  2414. * @link https://redis.io/commands/zrem
  2415. * @example
  2416. * <pre>
  2417. * $redisCluster->zAdd('z', 1, 'v1', 2, 'v2', 3, 'v3', 4, 'v4' ); // int(2)
  2418. * $redisCluster->zRem('z', 'v2', 'v3'); // int(2)
  2419. * var_dump( $redisCluster->zRange('z', 0, -1) );
  2420. * //// Output:
  2421. * //
  2422. * // array(2) {
  2423. * // [0]=> string(2) "v1"
  2424. * // [1]=> string(2) "v4"
  2425. * // }
  2426. * </pre>
  2427. */
  2428. public function zRem($key, $member1, $member2 = null, $memberN = null) { }
  2429. /**
  2430. * Sort
  2431. *
  2432. * @param string $key
  2433. * @param array $option array(key => value, ...) - optional, with the following keys and values:
  2434. * - 'by' => 'some_pattern_*',
  2435. * - 'limit' => array(0, 1),
  2436. * - 'get' => 'some_other_pattern_*' or an array of patterns,
  2437. * - 'sort' => 'asc' or 'desc',
  2438. * - 'alpha' => TRUE,
  2439. * - 'store' => 'external-key'
  2440. *
  2441. * @return array
  2442. * An array of values, or a number corresponding to the number of elements stored if that was used.
  2443. * @link https://redis.io/commands/sort
  2444. * @example
  2445. * <pre>
  2446. * $redisCluster->del('s');
  2447. * $redisCluster->sadd('s', 5);
  2448. * $redisCluster->sadd('s', 4);
  2449. * $redisCluster->sadd('s', 2);
  2450. * $redisCluster->sadd('s', 1);
  2451. * $redisCluster->sadd('s', 3);
  2452. *
  2453. * var_dump($redisCluster->sort('s')); // 1,2,3,4,5
  2454. * var_dump($redisCluster->sort('s', array('sort' => 'desc'))); // 5,4,3,2,1
  2455. * var_dump($redisCluster->sort('s', array('sort' => 'desc', 'store' => 'out'))); // (int)5
  2456. * </pre>
  2457. */
  2458. public function sort($key, $option = null) { }
  2459. /**
  2460. * Describes the object pointed to by a key.
  2461. * The information to retrieve (string) and the key (string).
  2462. * Info can be one of the following:
  2463. * - "encoding"
  2464. * - "refcount"
  2465. * - "idletime"
  2466. *
  2467. * @param string $string
  2468. * @param string $key
  2469. *
  2470. * @return string|false for "encoding", int for "refcount" and "idletime", FALSE if the key doesn't exist.
  2471. * @link https://redis.io/commands/object
  2472. * @example
  2473. * <pre>
  2474. * $redisCluster->object("encoding", "l"); // → ziplist
  2475. * $redisCluster->object("refcount", "l"); // → 1
  2476. * $redisCluster->object("idletime", "l"); // → 400 (in seconds, with a precision of 10 seconds).
  2477. * </pre>
  2478. */
  2479. public function object($string = '', $key = '') { }
  2480. /**
  2481. * Subscribe to channels. Warning: this function will probably change in the future.
  2482. *
  2483. * @param array $channels an array of channels to subscribe to
  2484. * @param string|array $callback either a string or an array($instance, 'method_name').
  2485. * The callback function receives 3 parameters: the redis instance, the channel
  2486. * name, and the message.
  2487. *
  2488. * @return mixed Any non-null return value in the callback will be returned to the caller.
  2489. * @link https://redis.io/commands/subscribe
  2490. * @example
  2491. * <pre>
  2492. * function f($redisCluster, $chan, $msg) {
  2493. * switch($chan) {
  2494. * case 'chan-1':
  2495. * ...
  2496. * break;
  2497. *
  2498. * case 'chan-2':
  2499. * ...
  2500. * break;
  2501. *
  2502. * case 'chan-2':
  2503. * ...
  2504. * break;
  2505. * }
  2506. * }
  2507. *
  2508. * $redisCluster->subscribe(array('chan-1', 'chan-2', 'chan-3'), 'f'); // subscribe to 3 chans
  2509. * </pre>
  2510. */
  2511. public function subscribe($channels, $callback) { }
  2512. /**
  2513. * Subscribe to channels by pattern
  2514. *
  2515. * @param array $patterns The number of elements removed from the set.
  2516. * @param string|array $callback Either a string or an array with an object and method.
  2517. * The callback will get four arguments ($redis, $pattern, $channel, $message)
  2518. *
  2519. * @return mixed Any non-null return value in the callback will be returned to the caller.
  2520. *
  2521. * @link https://redis.io/commands/psubscribe
  2522. * @example
  2523. * <pre>
  2524. * function psubscribe($redisCluster, $pattern, $chan, $msg) {
  2525. * echo "Pattern: $pattern\n";
  2526. * echo "Channel: $chan\n";
  2527. * echo "Payload: $msg\n";
  2528. * }
  2529. * </pre>
  2530. */
  2531. public function psubscribe($patterns, $callback) { }
  2532. /**
  2533. * Unsubscribes the client from the given channels, or from all of them if none is given.
  2534. *
  2535. * @param $channels
  2536. * @param $callback
  2537. */
  2538. public function unSubscribe($channels, $callback) { }
  2539. /**
  2540. * Unsubscribes the client from the given patterns, or from all of them if none is given.
  2541. *
  2542. * @param $channels
  2543. * @param $callback
  2544. */
  2545. public function punSubscribe($channels, $callback) { }
  2546. /**
  2547. * Evaluate a LUA script serverside, from the SHA1 hash of the script instead of the script itself.
  2548. * In order to run this command Redis will have to have already loaded the script, either by running it or via
  2549. * the SCRIPT LOAD command.
  2550. *
  2551. * @param string $scriptSha
  2552. * @param array $args
  2553. * @param int $numKeys
  2554. *
  2555. * @return mixed @see eval()
  2556. * @see eval()
  2557. * @link https://redis.io/commands/evalsha
  2558. * @example
  2559. * <pre>
  2560. * $script = 'return 1';
  2561. * $sha = $redisCluster->script('load', $script);
  2562. * $redisCluster->evalSha($sha); // Returns 1
  2563. * </pre>
  2564. */
  2565. public function evalSha($scriptSha, $args = array(), $numKeys = 0) { }
  2566. /**
  2567. * Scan the keyspace for keys.
  2568. *
  2569. * @param int &$iterator Iterator, initialized to NULL.
  2570. * @param string|array $node Node identified by key or host/port array
  2571. * @param string $pattern Pattern to match.
  2572. * @param int $count Count of keys per iteration (only a suggestion to Redis).
  2573. *
  2574. * @return array|false This function will return an array of keys or FALSE if there are no more keys.
  2575. * @link https://redis.io/commands/scan
  2576. * @example
  2577. * <pre>
  2578. * $iterator = null;
  2579. * while($keys = $redisCluster->scan($iterator)) {
  2580. * foreach($keys as $key) {
  2581. * echo $key . PHP_EOL;
  2582. * }
  2583. * }
  2584. * </pre>
  2585. */
  2586. public function scan(&$iterator, $node, $pattern = null, $count = 0) { }
  2587. /**
  2588. * Scan a set for members.
  2589. *
  2590. * @param string $key The set to search.
  2591. * @param int &$iterator LONG (reference) to the iterator as we go.
  2592. * @param null $pattern String, optional pattern to match against.
  2593. * @param int $count How many members to return at a time (Redis might return a different amount).
  2594. *
  2595. * @return array|false PHPRedis will return an array of keys or FALSE when we're done iterating.
  2596. * @link https://redis.io/commands/sscan
  2597. * @example
  2598. * <pre>
  2599. * $iterator = null;
  2600. * while ($members = $redisCluster->sScan('set', $iterator)) {
  2601. * foreach ($members as $member) {
  2602. * echo $member . PHP_EOL;
  2603. * }
  2604. * }
  2605. * </pre>
  2606. */
  2607. public function sScan($key, &$iterator, $pattern = null, $count = 0) { }
  2608. /**
  2609. * Scan a sorted set for members, with optional pattern and count.
  2610. *
  2611. * @param string $key String, the set to scan.
  2612. * @param int &$iterator Long (reference), initialized to NULL.
  2613. * @param string $pattern String (optional), the pattern to match.
  2614. * @param int $count How many keys to return per iteration (Redis might return a different number).
  2615. *
  2616. * @return array|false PHPRedis will return matching keys from Redis, or FALSE when iteration is complete.
  2617. * @link https://redis.io/commands/zscan
  2618. * @example
  2619. * <pre>
  2620. * $iterator = null;
  2621. * while ($members = $redis-zscan('zset', $iterator)) {
  2622. * foreach ($members as $member => $score) {
  2623. * echo $member . ' => ' . $score . PHP_EOL;
  2624. * }
  2625. * }
  2626. * </pre>
  2627. */
  2628. public function zScan($key, &$iterator, $pattern = null, $count = 0) { }
  2629. /**
  2630. * Scan a HASH value for members, with an optional pattern and count.
  2631. *
  2632. * @param string $key
  2633. * @param int &$iterator
  2634. * @param string $pattern Optional pattern to match against.
  2635. * @param int $count How many keys to return in a go (only a sugestion to Redis).
  2636. *
  2637. * @return array An array of members that match our pattern.
  2638. * @link https://redis.io/commands/hscan
  2639. * @example
  2640. * <pre>
  2641. * $iterator = null;
  2642. * while($elements = $redisCluster->hscan('hash', $iterator)) {
  2643. * foreach($elements as $key => $value) {
  2644. * echo $key . ' => ' . $value . PHP_EOL;
  2645. * }
  2646. * }
  2647. * </pre>
  2648. */
  2649. public function hScan($key, &$iterator, $pattern = null, $count = 0) { }
  2650. /**
  2651. * Detect whether we're in ATOMIC/MULTI/PIPELINE mode.
  2652. *
  2653. * @return int Either RedisCluster::ATOMIC, RedisCluster::MULTI or RedisCluster::PIPELINE
  2654. * @example $redisCluster->getMode();
  2655. */
  2656. public function getMode() { }
  2657. /**
  2658. * The last error message (if any)
  2659. *
  2660. * @return string|null A string with the last returned script based error message, or NULL if there is no error
  2661. * @example
  2662. * <pre>
  2663. * $redisCluster->eval('this-is-not-lua');
  2664. * $err = $redisCluster->getLastError();
  2665. * // "ERR Error compiling script (new function): user_script:1: '=' expected near '-'"
  2666. * </pre>
  2667. */
  2668. public function getLastError() { }
  2669. /**
  2670. * Clear the last error message
  2671. *
  2672. * @return bool true
  2673. * @example
  2674. * <pre>
  2675. * $redisCluster->set('x', 'a');
  2676. * $redisCluster->incr('x');
  2677. * $err = $redisCluster->getLastError();
  2678. * // "ERR value is not an integer or out of range"
  2679. * $redisCluster->clearLastError();
  2680. * $err = $redisCluster->getLastError();
  2681. * // NULL
  2682. * </pre>
  2683. */
  2684. public function clearLastError() { }
  2685. /**
  2686. * Get client option
  2687. *
  2688. * @param string $name parameter name
  2689. *
  2690. * @return int Parameter value.
  2691. * @example
  2692. * // return RedisCluster::SERIALIZER_NONE, RedisCluster::SERIALIZER_PHP, or RedisCluster::SERIALIZER_IGBINARY.
  2693. * $redisCluster->getOption(RedisCluster::OPT_SERIALIZER);
  2694. */
  2695. public function getOption($name) { }
  2696. /**
  2697. * Set client option.
  2698. *
  2699. * @param string $name parameter name
  2700. * @param string $value parameter value
  2701. *
  2702. * @return bool TRUE on success, FALSE on error.
  2703. * @example
  2704. * <pre>
  2705. * $redisCluster->setOption(RedisCluster::OPT_SERIALIZER, RedisCluster::SERIALIZER_NONE); // don't serialize data
  2706. * $redisCluster->setOption(RedisCluster::OPT_SERIALIZER, RedisCluster::SERIALIZER_PHP); // use built-in serialize/unserialize
  2707. * $redisCluster->setOption(RedisCluster::OPT_SERIALIZER, RedisCluster::SERIALIZER_IGBINARY); // use igBinary serialize/unserialize
  2708. * $redisCluster->setOption(RedisCluster::OPT_PREFIX, 'myAppName:'); // use custom prefix on all keys
  2709. * </pre>
  2710. */
  2711. public function setOption($name, $value) { }
  2712. /**
  2713. * A utility method to prefix the value with the prefix setting for phpredis.
  2714. *
  2715. * @param mixed $value The value you wish to prefix
  2716. *
  2717. * @return string If a prefix is set up, the value now prefixed. If there is no prefix, the value will be returned unchanged.
  2718. * @example
  2719. * <pre>
  2720. * $redisCluster->setOption(RedisCluster::OPT_PREFIX, 'my-prefix:');
  2721. * $redisCluster->_prefix('my-value'); // Will return 'my-prefix:my-value'
  2722. * </pre>
  2723. */
  2724. public function _prefix($value) { }
  2725. /**
  2726. * A utility method to serialize values manually. This method allows you to serialize a value with whatever
  2727. * serializer is configured, manually. This can be useful for serialization/unserialization of data going in
  2728. * and out of EVAL commands as phpredis can't automatically do this itself. Note that if no serializer is
  2729. * set, phpredis will change Array values to 'Array', and Objects to 'Object'.
  2730. *
  2731. * @param mixed $value The value to be serialized.
  2732. *
  2733. * @return mixed
  2734. * @example
  2735. * <pre>
  2736. * $redisCluster->setOption(RedisCluster::OPT_SERIALIZER, RedisCluster::SERIALIZER_NONE);
  2737. * $redisCluster->_serialize("foo"); // returns "foo"
  2738. * $redisCluster->_serialize(Array()); // Returns "Array"
  2739. * $redisCluster->_serialize(new stdClass()); // Returns "Object"
  2740. *
  2741. * $redisCluster->setOption(RedisCluster::OPT_SERIALIZER, RedisCluster::SERIALIZER_PHP);
  2742. * $redisCluster->_serialize("foo"); // Returns 's:3:"foo";'
  2743. * </pre>
  2744. */
  2745. public function _serialize($value) { }
  2746. /**
  2747. * A utility method to unserialize data with whatever serializer is set up. If there is no serializer set, the
  2748. * value will be returned unchanged. If there is a serializer set up, and the data passed in is malformed, an
  2749. * exception will be thrown. This can be useful if phpredis is serializing values, and you return something from
  2750. * redis in a LUA script that is serialized.
  2751. *
  2752. * @param string $value The value to be unserialized
  2753. *
  2754. * @return mixed
  2755. * @example
  2756. * <pre>
  2757. * $redisCluster->setOption(RedisCluster::OPT_SERIALIZER, RedisCluster::SERIALIZER_PHP);
  2758. * $redisCluster->_unserialize('a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}'); // Will return Array(1,2,3)
  2759. * </pre>
  2760. */
  2761. public function _unserialize($value) { }
  2762. /**
  2763. * Return all redis master nodes
  2764. *
  2765. * @return array
  2766. * @example
  2767. * <pre>
  2768. * $redisCluster->_masters(); // Will return [[0=>'127.0.0.1','6379'],[0=>'127.0.0.1','6380']]
  2769. * </pre>
  2770. */
  2771. public function _masters() { }
  2772. /**
  2773. * Enter and exit transactional mode.
  2774. *
  2775. * @param int $mode RedisCluster::MULTI|RedisCluster::PIPELINE
  2776. * Defaults to RedisCluster::MULTI.
  2777. * A RedisCluster::MULTI block of commands runs as a single transaction;
  2778. * a RedisCluster::PIPELINE block is simply transmitted faster to the server, but without any guarantee
  2779. * of atomicity. discard cancels a transaction.
  2780. *
  2781. * @return Redis returns the Redis instance and enters multi-mode.
  2782. * Once in multi-mode, all subsequent method calls return the same object until exec() is called.
  2783. * @link https://redis.io/commands/multi
  2784. * @example
  2785. * <pre>
  2786. * $ret = $redisCluster->multi()
  2787. * ->set('key1', 'val1')
  2788. * ->get('key1')
  2789. * ->set('key2', 'val2')
  2790. * ->get('key2')
  2791. * ->exec();
  2792. *
  2793. * //$ret == array (
  2794. * // 0 => TRUE,
  2795. * // 1 => 'val1',
  2796. * // 2 => TRUE,
  2797. * // 3 => 'val2');
  2798. * </pre>
  2799. */
  2800. public function multi($mode = RedisCluster::MULTI) { }
  2801. /**
  2802. * @see multi()
  2803. * @return void|array
  2804. * @link https://redis.io/commands/exec
  2805. */
  2806. public function exec() { }
  2807. /**
  2808. * @see multi()
  2809. * @link https://redis.io/commands/discard
  2810. */
  2811. public function discard() { }
  2812. /**
  2813. * Watches a key for modifications by another client. If the key is modified between WATCH and EXEC,
  2814. * the MULTI/EXEC transaction will fail (return FALSE). unwatch cancels all the watching of all keys by this client.
  2815. *
  2816. * @param string|array $key : a list of keys
  2817. *
  2818. * @return void
  2819. * @link https://redis.io/commands/watch
  2820. * @example
  2821. * <pre>
  2822. * $redisCluster->watch('x');
  2823. * // long code here during the execution of which other clients could well modify `x`
  2824. * $ret = $redisCluster->multi()
  2825. * ->incr('x')
  2826. * ->exec();
  2827. * // $ret = FALSE if x has been modified between the call to WATCH and the call to EXEC.
  2828. * </pre>
  2829. */
  2830. public function watch($key) { }
  2831. /**
  2832. * @see watch()
  2833. * @link https://redis.io/commands/unwatch
  2834. */
  2835. public function unwatch() { }
  2836. /**
  2837. * Performs a synchronous save at a specific node.
  2838. *
  2839. * @param string|array $nodeParams key or [host,port]
  2840. *
  2841. * @return bool TRUE in case of success, FALSE in case of failure.
  2842. * If a save is already running, this command will fail and return FALSE.
  2843. * @link https://redis.io/commands/save
  2844. * @example
  2845. * $redisCluster->save('x'); //key
  2846. * $redisCluster->save(['127.0.0.1',6379]); //[host,port]
  2847. */
  2848. public function save($nodeParams) { }
  2849. /**
  2850. * Performs a background save at a specific node.
  2851. *
  2852. * @param string|array $nodeParams key or [host,port]
  2853. *
  2854. * @return bool TRUE in case of success, FALSE in case of failure.
  2855. * If a save is already running, this command will fail and return FALSE.
  2856. * @link https://redis.io/commands/bgsave
  2857. */
  2858. public function bgsave($nodeParams) { }
  2859. /**
  2860. * Removes all entries from the current database at a specific node.
  2861. *
  2862. * @param string|array $nodeParams key or [host,port]
  2863. *
  2864. * @return bool Always TRUE.
  2865. * @link https://redis.io/commands/flushdb
  2866. */
  2867. public function flushDB($nodeParams) { }
  2868. /**
  2869. * Removes all entries from all databases at a specific node.
  2870. *
  2871. * @param string|array $nodeParams key or [host,port]
  2872. *
  2873. * @return bool Always TRUE.
  2874. * @link https://redis.io/commands/flushall
  2875. */
  2876. public function flushAll($nodeParams) { }
  2877. /**
  2878. * Returns the current database's size at a specific node.
  2879. *
  2880. * @param string|array $nodeParams key or [host,port]
  2881. *
  2882. * @return int DB size, in number of keys.
  2883. * @link https://redis.io/commands/dbsize
  2884. * @example
  2885. * <pre>
  2886. * $count = $redisCluster->dbSize('x');
  2887. * echo "Redis has $count keys\n";
  2888. * </pre>
  2889. */
  2890. public function dbSize($nodeParams) { }
  2891. /**
  2892. * Starts the background rewrite of AOF (Append-Only File) at a specific node.
  2893. *
  2894. * @param string|array $nodeParams key or [host,port]
  2895. *
  2896. * @return bool TRUE in case of success, FALSE in case of failure.
  2897. * @link https://redis.io/commands/bgrewriteaof
  2898. * @example $redisCluster->bgrewriteaof('x');
  2899. */
  2900. public function bgrewriteaof($nodeParams) { }
  2901. /**
  2902. * Returns the timestamp of the last disk save at a specific node.
  2903. *
  2904. * @param string|array $nodeParams key or [host,port]
  2905. *
  2906. * @return int timestamp.
  2907. * @link https://redis.io/commands/lastsave
  2908. * @example $redisCluster->lastSave('x');
  2909. */
  2910. public function lastSave($nodeParams) { }
  2911. /**
  2912. * Returns an associative array of strings and integers
  2913. *
  2914. * @param string $option Optional. The option to provide redis.
  2915. * SERVER | CLIENTS | MEMORY | PERSISTENCE | STATS | REPLICATION | CPU | CLASTER | KEYSPACE
  2916. * | COMANDSTATS
  2917. *
  2918. * Returns an associative array of strings and integers, with the following keys:
  2919. * - redis_version
  2920. * - redis_git_sha1
  2921. * - redis_git_dirty
  2922. * - redis_build_id
  2923. * - redis_mode
  2924. * - os
  2925. * - arch_bits
  2926. * - multiplexing_api
  2927. * - atomicvar_api
  2928. * - gcc_version
  2929. * - process_id
  2930. * - run_id
  2931. * - tcp_port
  2932. * - uptime_in_seconds
  2933. * - uptime_in_days
  2934. * - hz
  2935. * - lru_clock
  2936. * - executable
  2937. * - config_file
  2938. * - connected_clients
  2939. * - client_longest_output_list
  2940. * - client_biggest_input_buf
  2941. * - blocked_clients
  2942. * - used_memory
  2943. * - used_memory_human
  2944. * - used_memory_rss
  2945. * - used_memory_rss_human
  2946. * - used_memory_peak
  2947. * - used_memory_peak_human
  2948. * - used_memory_peak_perc
  2949. * - used_memory_peak
  2950. * - used_memory_overhead
  2951. * - used_memory_startup
  2952. * - used_memory_dataset
  2953. * - used_memory_dataset_perc
  2954. * - total_system_memory
  2955. * - total_system_memory_human
  2956. * - used_memory_lua
  2957. * - used_memory_lua_human
  2958. * - maxmemory
  2959. * - maxmemory_human
  2960. * - maxmemory_policy
  2961. * - mem_fragmentation_ratio
  2962. * - mem_allocator
  2963. * - active_defrag_running
  2964. * - lazyfree_pending_objects
  2965. * - mem_fragmentation_ratio
  2966. * - loading
  2967. * - rdb_changes_since_last_save
  2968. * - rdb_bgsave_in_progress
  2969. * - rdb_last_save_time
  2970. * - rdb_last_bgsave_status
  2971. * - rdb_last_bgsave_time_sec
  2972. * - rdb_current_bgsave_time_sec
  2973. * - rdb_last_cow_size
  2974. * - aof_enabled
  2975. * - aof_rewrite_in_progress
  2976. * - aof_rewrite_scheduled
  2977. * - aof_last_rewrite_time_sec
  2978. * - aof_current_rewrite_time_sec
  2979. * - aof_last_bgrewrite_status
  2980. * - aof_last_write_status
  2981. * - aof_last_cow_size
  2982. * - changes_since_last_save
  2983. * - aof_current_size
  2984. * - aof_base_size
  2985. * - aof_pending_rewrite
  2986. * - aof_buffer_length
  2987. * - aof_rewrite_buffer_length
  2988. * - aof_pending_bio_fsync
  2989. * - aof_delayed_fsync
  2990. * - loading_start_time
  2991. * - loading_total_bytes
  2992. * - loading_loaded_bytes
  2993. * - loading_loaded_perc
  2994. * - loading_eta_seconds
  2995. * - total_connections_received
  2996. * - total_commands_processed
  2997. * - instantaneous_ops_per_sec
  2998. * - total_net_input_bytes
  2999. * - total_net_output_bytes
  3000. * - instantaneous_input_kbps
  3001. * - instantaneous_output_kbps
  3002. * - rejected_connections
  3003. * - maxclients
  3004. * - sync_full
  3005. * - sync_partial_ok
  3006. * - sync_partial_err
  3007. * - expired_keys
  3008. * - evicted_keys
  3009. * - keyspace_hits
  3010. * - keyspace_misses
  3011. * - pubsub_channels
  3012. * - pubsub_patterns
  3013. * - latest_fork_usec
  3014. * - migrate_cached_sockets
  3015. * - slave_expires_tracked_keys
  3016. * - active_defrag_hits
  3017. * - active_defrag_misses
  3018. * - active_defrag_key_hits
  3019. * - active_defrag_key_misses
  3020. * - role
  3021. * - master_replid
  3022. * - master_replid2
  3023. * - master_repl_offset
  3024. * - second_repl_offset
  3025. * - repl_backlog_active
  3026. * - repl_backlog_size
  3027. * - repl_backlog_first_byte_offset
  3028. * - repl_backlog_histlen
  3029. * - master_host
  3030. * - master_port
  3031. * - master_link_status
  3032. * - master_last_io_seconds_ago
  3033. * - master_sync_in_progress
  3034. * - slave_repl_offset
  3035. * - slave_priority
  3036. * - slave_read_only
  3037. * - master_sync_left_bytes
  3038. * - master_sync_last_io_seconds_ago
  3039. * - master_link_down_since_seconds
  3040. * - connected_slaves
  3041. * - min-slaves-to-write
  3042. * - min-replicas-to-write
  3043. * - min_slaves_good_slaves
  3044. * - used_cpu_sys
  3045. * - used_cpu_user
  3046. * - used_cpu_sys_children
  3047. * - used_cpu_user_children
  3048. * - cluster_enabled
  3049. *
  3050. * @link https://redis.io/commands/info
  3051. * @return array
  3052. * @example
  3053. * <pre>
  3054. * $redisCluster->info();
  3055. *
  3056. * or
  3057. *
  3058. * $redisCluster->info("COMMANDSTATS"); //Information on the commands that have been run (>=2.6 only)
  3059. * $redisCluster->info("CPU"); // just CPU information from Redis INFO
  3060. * </pre>
  3061. */
  3062. public function info($option = null) { }
  3063. /**
  3064. * @since redis >= 2.8.12.
  3065. * Returns the role of the instance in the context of replication
  3066. *
  3067. * @param string|array $nodeParams key or [host,port]
  3068. *
  3069. * @return array
  3070. * @link https://redis.io/commands/role
  3071. * @example
  3072. * <pre>
  3073. * $redisCluster->role(['127.0.0.1',6379]);
  3074. * // [ 0=>'master',1 => 3129659, 2 => [ ['127.0.0.1','9001','3129242'], ['127.0.0.1','9002','3129543'] ] ]
  3075. * </pre>
  3076. */
  3077. public function role($nodeParams) { }
  3078. /**
  3079. * Returns a random key at the specified node
  3080. *
  3081. * @param string|array $nodeParams key or [host,port]
  3082. *
  3083. * @return string an existing key in redis.
  3084. * @link https://redis.io/commands/randomkey
  3085. * @example
  3086. * <pre>
  3087. * $key = $redisCluster->randomKey('x');
  3088. * $surprise = $redisCluster->get($key); // who knows what's in there.
  3089. * </pre>
  3090. */
  3091. public function randomKey($nodeParams) { }
  3092. /**
  3093. * Return the specified node server time.
  3094. *
  3095. * @param string|array $nodeParams key or [host,port]
  3096. *
  3097. * @return array If successfully, the time will come back as an associative array with element zero being the
  3098. * unix timestamp, and element one being microseconds.
  3099. * @link https://redis.io/commands/time
  3100. * @example
  3101. * <pre>
  3102. * var_dump( $redisCluster->time('x') );
  3103. * //// Output:
  3104. * //
  3105. * // array(2) {
  3106. * // [0] => string(10) "1342364352"
  3107. * // [1] => string(6) "253002"
  3108. * // }
  3109. * </pre>
  3110. */
  3111. public function time($nodeParams) { }
  3112. /**
  3113. * Check the specified node status
  3114. *
  3115. * @param string|array $nodeParams key or [host,port]
  3116. *
  3117. * @return string STRING: +PONG on success. Throws a RedisException object on connectivity error, as described
  3118. * above.
  3119. * @link https://redis.io/commands/ping
  3120. */
  3121. public function ping($nodeParams) { }
  3122. /**
  3123. * Returns message.
  3124. *
  3125. * @param string|array $nodeParams key or [host,port]
  3126. * @param string $msg
  3127. *
  3128. * @return mixed
  3129. */
  3130. public function echo ($nodeParams, $msg) { }
  3131. /**
  3132. * Returns Array reply of details about all Redis Cluster commands.
  3133. *
  3134. * @return mixed array | bool
  3135. */
  3136. public function command() { }
  3137. /**
  3138. * Send arbitrary things to the redis server at the specified node
  3139. *
  3140. * @param string|array $nodeParams key or [host,port]
  3141. * @param string $command Required command to send to the server.
  3142. * @param mixed $arguments Optional variable amount of arguments to send to the server.
  3143. *
  3144. * @return mixed
  3145. */
  3146. public function rawCommand($nodeParams, $command, $arguments) { }
  3147. /**
  3148. * @since redis >= 3.0
  3149. * Executes cluster command
  3150. *
  3151. * @param string|array $nodeParams key or [host,port]
  3152. * @param string $command Required command to send to the server.
  3153. * @param mixed $arguments Optional variable amount of arguments to send to the server.
  3154. *
  3155. * @return mixed
  3156. * @link https://redis.io/commands#cluster
  3157. * @example
  3158. * <pre>
  3159. * $redisCluster->cluster(['127.0.0.1',6379],'INFO');
  3160. * </pre>
  3161. */
  3162. public function cluster($nodeParams, $command, $arguments) { }
  3163. /**
  3164. * Allows you to get information of the cluster client
  3165. *
  3166. * @param string|array $nodeParams key or [host,port]
  3167. * @param string $subCmd can be: 'LIST', 'KILL', 'GETNAME', or 'SETNAME'
  3168. * @param string $args optional arguments
  3169. */
  3170. public function client($nodeParams, $subCmd, $args) { }
  3171. /**
  3172. * Get or Set the redis config keys.
  3173. *
  3174. * @param string|array $nodeParams key or [host,port]
  3175. * @param string $operation either `GET` or `SET`
  3176. * @param string $key for `SET`, glob-pattern for `GET`. See https://redis.io/commands/config-get for examples.
  3177. * @param string $value optional string (only for `SET`)
  3178. *
  3179. * @return array Associative array for `GET`, key -> value
  3180. * @link https://redis.io/commands/config-get
  3181. * @link https://redis.io/commands/config-set
  3182. * @example
  3183. * <pre>
  3184. * $redisCluster->config(['127.0.0.1',6379], "GET", "*max-*-entries*");
  3185. * $redisCluster->config(['127.0.0.1',6379], "SET", "dir", "/var/run/redis/dumps/");
  3186. * </pre>
  3187. */
  3188. public function config($nodeParams, $operation, $key, $value) { }
  3189. /**
  3190. * A command allowing you to get information on the Redis pub/sub system.
  3191. *
  3192. * @param string|array $nodeParams key or [host,port]
  3193. *
  3194. * @param string $keyword String, which can be: "channels", "numsub", or "numpat"
  3195. * @param string|array $argument Optional, variant.
  3196. * For the "channels" subcommand, you can pass a string pattern.
  3197. * For "numsub" an array of channel names
  3198. *
  3199. * @return array|int Either an integer or an array.
  3200. * - channels Returns an array where the members are the matching channels.
  3201. * - numsub Returns a key/value array where the keys are channel names and
  3202. * values are their counts.
  3203. * - numpat Integer return containing the number active pattern subscriptions.
  3204. * @link https://redis.io/commands/pubsub
  3205. * @example
  3206. * <pre>
  3207. * $redisCluster->pubsub(['127.0.0.1',6379], 'channels'); // All channels
  3208. * $redisCluster->pubsub(['127.0.0.1',6379], 'channels', '*pattern*'); // Just channels matching your pattern
  3209. * $redisCluster->pubsub(['127.0.0.1',6379], 'numsub', array('chan1', 'chan2')); // Get subscriber counts for
  3210. * 'chan1' and 'chan2'
  3211. * $redisCluster->pubsub(['127.0.0.1',6379], 'numpat'); // Get the number of pattern subscribers
  3212. * </pre>
  3213. */
  3214. public function pubsub($nodeParams, $keyword, $argument) { }
  3215. /**
  3216. * Execute the Redis SCRIPT command to perform various operations on the scripting subsystem.
  3217. *
  3218. * @param string|array $nodeParams key or [host,port]
  3219. * @param string $command load | flush | kill | exists
  3220. * @param string $script
  3221. *
  3222. * @return mixed
  3223. * @link https://redis.io/commands/script-load
  3224. * @link https://redis.io/commands/script-kill
  3225. * @link https://redis.io/commands/script-flush
  3226. * @link https://redis.io/commands/script-exists
  3227. * @example
  3228. * <pre>
  3229. * $redisCluster->script(['127.0.0.1',6379], 'load', $script);
  3230. * $redisCluster->script(['127.0.0.1',6379], 'flush');
  3231. * $redisCluster->script(['127.0.0.1',6379], 'kill');
  3232. * $redisCluster->script(['127.0.0.1',6379], 'exists', $script1, [$script2, $script3, ...]);
  3233. * </pre>
  3234. *
  3235. * SCRIPT LOAD will return the SHA1 hash of the passed script on success, and FALSE on failure.
  3236. * SCRIPT FLUSH should always return TRUE
  3237. * SCRIPT KILL will return true if a script was able to be killed and false if not
  3238. * SCRIPT EXISTS will return an array with TRUE or FALSE for each passed script
  3239. */
  3240. public function script($nodeParams, $command, $script) { }
  3241. /**
  3242. * This function is used in order to read and reset the Redis slow queries log.
  3243. *
  3244. * @param string|array $nodeParams key or [host,port]
  3245. * @param string $command
  3246. * @param mixed $argument
  3247. *
  3248. * @link https://redis.io/commands/slowlog
  3249. * @example
  3250. * <pre>
  3251. * $redisCluster->slowLog(['127.0.0.1',6379],'get','2');
  3252. * </pre>
  3253. */
  3254. public function slowLog($nodeParams, $command, $argument) { }
  3255. /**
  3256. * Add one or more geospatial items in the geospatial index represented using a sorted set
  3257. *
  3258. * @param string $key
  3259. * @param float $longitude
  3260. * @param float $latitude
  3261. * @param string $member
  3262. *
  3263. * @link https://redis.io/commands/geoadd
  3264. * @example
  3265. * <pre>
  3266. * $redisCluster->geoAdd('Sicily', 13.361389, 38.115556, 'Palermo'); // int(1)
  3267. * $redisCluster->geoAdd('Sicily', 15.087269, 37.502669, "Catania"); // int(1)
  3268. * </pre>
  3269. */
  3270. public function geoAdd($key, $longitude, $latitude, $member) { }
  3271. /**
  3272. * Returns members of a geospatial index as standard geohash strings
  3273. *
  3274. * @param string $key
  3275. * @param string $member1
  3276. * @param string $member2
  3277. * @param string $memberN
  3278. *
  3279. * @example
  3280. * <pre>
  3281. * $redisCluster->geoAdd('Sicily', 13.361389, 38.115556, 'Palermo'); // int(1)
  3282. * $redisCluster->geoAdd('Sicily', 15.087269, 37.502669, "Catania"); // int(1)
  3283. * $redisCluster->geohash('Sicily','Palermo','Catania');//['sqc8b49rny0','sqdtr74hyu0']
  3284. * </pre>
  3285. */
  3286. public function geohash($key, $member1, $member2 = null, $memberN = null) { }
  3287. /**
  3288. * Returns longitude and latitude of members of a geospatial index
  3289. *
  3290. * @param string $key
  3291. * @param string $member1
  3292. * @param string $member2
  3293. * @param string $memberN
  3294. * @example
  3295. * <pre>
  3296. * $redisCluster->geoAdd('Sicily', 15.087269, 37.502669, "Catania"); // int(1)
  3297. * $redisCluster->geopos('Sicily','Palermo');//[['13.36138933897018433','38.11555639549629859']]
  3298. * </pre>
  3299. */
  3300. public function geopos($key, $member1, $member2 = null, $memberN = null) { }
  3301. /**
  3302. *
  3303. * Returns the distance between two members of a geospatial index
  3304. *
  3305. * @param string $key
  3306. * @param string $member1
  3307. * @param string $member2
  3308. * @param string $unit The unit must be one of the following, and defaults to meters:
  3309. * m for meters.
  3310. * km for kilometers.
  3311. * mi for miles.
  3312. * ft for feet.
  3313. *
  3314. * @link https://redis.io/commands/geoadd
  3315. * @example
  3316. * <pre>
  3317. * $redisCluster->geoAdd('Sicily', 13.361389, 38.115556, 'Palermo'); // int(1)
  3318. * $redisCluster->geoAdd('Sicily', 15.087269, 37.502669, "Catania"); // int(1)
  3319. * $redisCluster->geoDist('Sicily', 'Palermo' ,'Catania'); // float(166274.1516)
  3320. * $redisCluster->geoDist('Sicily', 'Palermo','Catania', 'km'); // float(166.2742)
  3321. * </pre>
  3322. */
  3323. public function geoDist($key, $member1, $member2, $unit = 'm') { }
  3324. /**
  3325. * Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point
  3326. *
  3327. * @param string $key
  3328. * @param float $longitude
  3329. * @param float $latitude
  3330. * @param float $radius
  3331. * @param string $radiusUnit String can be: "m" for meters; "km" for kilometers , "mi" for miles, or "ft" for feet.
  3332. * @param array $options
  3333. *
  3334. * @link https://redis.io/commands/georadius
  3335. * @example
  3336. * <pre>
  3337. * $redisCluster->del('Sicily');
  3338. * $redisCluster->geoAdd('Sicily', 12.361389, 35.115556, 'Palermo'); // int(1)
  3339. * $redisCluster->geoAdd('Sicily', 15.087269, 37.502669, "Catania"); // int(1)
  3340. * $redisCluster->geoAdd('Sicily', 13.3585, 35.330022, "Agrigento"); // int(1)
  3341. *
  3342. * var_dump( $redisCluster->geoRadius('Sicily',13.3585, 35.330022, 300, 'km', ['WITHDIST' ,'DESC']) );
  3343. *
  3344. * array(3) {
  3345. * [0]=>
  3346. * array(2) {
  3347. * [0]=>
  3348. * string(7) "Catania"
  3349. * [1]=>
  3350. * string(8) "286.9362"
  3351. * }
  3352. * [1]=>
  3353. * array(2) {
  3354. * [0]=>
  3355. * string(7) "Palermo"
  3356. * [1]=>
  3357. * string(7) "93.6874"
  3358. * }
  3359. * [2]=>
  3360. * array(2) {
  3361. * [0]=>
  3362. * string(9) "Agrigento"
  3363. * [1]=>
  3364. * string(6) "0.0002"
  3365. * }
  3366. * }
  3367. * var_dump( $redisCluster->geoRadiusByMember('Sicily','Agrigento', 100, 'km', ['WITHDIST' ,'DESC']) );
  3368. *
  3369. * * array(2) {
  3370. * [0]=>
  3371. * array(2) {
  3372. * [0]=>
  3373. * string(7) "Palermo"
  3374. * [1]=>
  3375. * string(7) "93.6872"
  3376. * }
  3377. * [1]=>
  3378. * array(2) {
  3379. * [0]=>
  3380. * string(9) "Agrigento"
  3381. * [1]=>
  3382. * string(6) "0.0000"
  3383. * }
  3384. * }
  3385. *
  3386. * <pre>
  3387. */
  3388. public function geoRadius($key, $longitude, $latitude, $radius, $radiusUnit, array $options) { }
  3389. /**
  3390. * Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member
  3391. *
  3392. * @see geoRadius
  3393. *
  3394. * @param string $key
  3395. * @param string $member
  3396. * @param float $radius
  3397. * @param string $radiusUnit
  3398. * @param array $options
  3399. */
  3400. public function geoRadiusByMember($key, $member, $radius, $radiusUnit, array $options) { }
  3401. }
  3402. class RedisClusterException extends Exception {}