You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

redis_cluster.php 120KB

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