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.php 154KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262
  1. <?php
  2. /**
  3. * Helper autocomplete for php redis extension
  4. *
  5. * @author Max Kamashev <max.kamashev@gmail.com>
  6. * @link https://github.com/ukko/phpredis-phpdoc
  7. */
  8. class Redis
  9. {
  10. const AFTER = 'after';
  11. const BEFORE = 'before';
  12. /**
  13. * Options
  14. */
  15. const OPT_SERIALIZER = 1;
  16. const OPT_PREFIX = 2;
  17. const OPT_READ_TIMEOUT = 3;
  18. const OPT_SCAN = 4;
  19. const OPT_FAILOVER = 5;
  20. const OPT_TCP_KEEPALIVE = 6;
  21. const OPT_COMPRESSION = 7;
  22. const OPT_REPLY_LITERAL = 8;
  23. const OPT_COMPRESSION_LEVEL = 9;
  24. /**
  25. * Cluster options
  26. */
  27. const FAILOVER_NONE = 0;
  28. const FAILOVER_ERROR = 1;
  29. const FAILOVER_DISTRIBUTE = 2;
  30. const FAILOVER_DISTRIBUTE_SLAVES = 3;
  31. /**
  32. * SCAN options
  33. */
  34. const SCAN_NORETRY = 0;
  35. const SCAN_RETRY = 1;
  36. /**
  37. * Serializers
  38. */
  39. const SERIALIZER_NONE = 0;
  40. const SERIALIZER_PHP = 1;
  41. const SERIALIZER_IGBINARY = 2;
  42. const SERIALIZER_MSGPACK = 3;
  43. const SERIALIZER_JSON = 4;
  44. /**
  45. * Compressions
  46. */
  47. const COMPRESSION_NONE = 0;
  48. const COMPRESSION_LZF = 1;
  49. const COMPRESSION_ZSTD = 2;
  50. /**
  51. * Compression ZSTD levels
  52. */
  53. const COMPRESSION_ZSTD_MIN = 1;
  54. const COMPRESSION_ZSTD_DEFAULT = 3;
  55. const COMPRESSION_ZSTD_MAX = 22;
  56. /**
  57. * Multi
  58. */
  59. const ATOMIC = 0;
  60. const MULTI = 1;
  61. const PIPELINE = 2;
  62. /**
  63. * Type
  64. */
  65. const REDIS_NOT_FOUND = 0;
  66. const REDIS_STRING = 1;
  67. const REDIS_SET = 2;
  68. const REDIS_LIST = 3;
  69. const REDIS_ZSET = 4;
  70. const REDIS_HASH = 5;
  71. const REDIS_STREAM = 6;
  72. /**
  73. * Creates a Redis client
  74. *
  75. * @example $redis = new Redis();
  76. */
  77. public function __construct()
  78. {
  79. }
  80. /**
  81. * Connects to a Redis instance.
  82. *
  83. * @param string $host can be a host, or the path to a unix domain socket
  84. * @param int $port optional
  85. * @param float $timeout value in seconds (optional, default is 0.0 meaning unlimited)
  86. * @param null $reserved should be null if $retryInterval is specified
  87. * @param int $retryInterval retry interval in milliseconds.
  88. * @param float $readTimeout value in seconds (optional, default is 0 meaning unlimited)
  89. *
  90. * @return bool TRUE on success, FALSE on error
  91. *
  92. * @example
  93. * <pre>
  94. * $redis->connect('127.0.0.1', 6379);
  95. * $redis->connect('127.0.0.1'); // port 6379 by default
  96. * $redis->connect('127.0.0.1', 6379, 2.5); // 2.5 sec timeout.
  97. * $redis->connect('/tmp/redis.sock'); // unix domain socket.
  98. * </pre>
  99. */
  100. public function connect(
  101. $host,
  102. $port = 6379,
  103. $timeout = 0.0,
  104. $reserved = null,
  105. $retryInterval = 0,
  106. $readTimeout = 0.0
  107. ) {
  108. }
  109. /**
  110. * Connects to a Redis instance.
  111. *
  112. * @param string $host can be a host, or the path to a unix domain socket
  113. * @param int $port optional
  114. * @param float $timeout value in seconds (optional, default is 0.0 meaning unlimited)
  115. * @param null $reserved should be null if $retry_interval is specified
  116. * @param int $retryInterval retry interval in milliseconds.
  117. * @param float $readTimeout value in seconds (optional, default is 0 meaning unlimited)
  118. *
  119. * @return bool TRUE on success, FALSE on error
  120. *
  121. * @see connect()
  122. * @deprecated use Redis::connect()
  123. */
  124. public function open(
  125. $host,
  126. $port = 6379,
  127. $timeout = 0.0,
  128. $reserved = null,
  129. $retryInterval = 0,
  130. $readTimeout = 0.0
  131. ) {
  132. }
  133. /**
  134. * A method to determine if a phpredis object thinks it's connected to a server
  135. *
  136. * @return bool Returns TRUE if phpredis thinks it's connected and FALSE if not
  137. */
  138. public function isConnected()
  139. {
  140. }
  141. /**
  142. * Retrieve our host or unix socket that we're connected to
  143. *
  144. * @return string|bool The host or unix socket we're connected to or FALSE if we're not connected
  145. */
  146. public function getHost()
  147. {
  148. }
  149. /**
  150. * Get the port we're connected to
  151. *
  152. * @return int|bool Returns the port we're connected to or FALSE if we're not connected
  153. */
  154. public function getPort()
  155. {
  156. }
  157. /**
  158. * Get the database number phpredis is pointed to
  159. *
  160. * @return int|bool Returns the database number (int) phpredis thinks it's pointing to
  161. * or FALSE if we're not connected
  162. */
  163. public function getDbNum()
  164. {
  165. }
  166. /**
  167. * Get the (write) timeout in use for phpredis
  168. *
  169. * @return float|bool The timeout (DOUBLE) specified in our connect call or FALSE if we're not connected
  170. */
  171. public function getTimeout()
  172. {
  173. }
  174. /**
  175. * Get the read timeout specified to phpredis or FALSE if we're not connected
  176. *
  177. * @return float|bool Returns the read timeout (which can be set using setOption and Redis::OPT_READ_TIMEOUT)
  178. * or FALSE if we're not connected
  179. */
  180. public function getReadTimeout()
  181. {
  182. }
  183. /**
  184. * Gets the persistent ID that phpredis is using
  185. *
  186. * @return string|null|bool Returns the persistent id phpredis is using
  187. * (which will only be set if connected with pconnect),
  188. * NULL if we're not using a persistent ID,
  189. * and FALSE if we're not connected
  190. */
  191. public function getPersistentID()
  192. {
  193. }
  194. /**
  195. * Get the password used to authenticate the phpredis connection
  196. *
  197. * @return string|null|bool Returns the password used to authenticate a phpredis session or NULL if none was used,
  198. * and FALSE if we're not connected
  199. */
  200. public function getAuth()
  201. {
  202. }
  203. /**
  204. * Connects to a Redis instance or reuse a connection already established with pconnect/popen.
  205. *
  206. * The connection will not be closed on close or end of request until the php process ends.
  207. * So be patient on to many open FD's (specially on redis server side) when using persistent connections on
  208. * many servers connecting to one redis server.
  209. *
  210. * Also more than one persistent connection can be made identified by either host + port + timeout
  211. * or host + persistentId or unix socket + timeout.
  212. *
  213. * This feature is not available in threaded versions. pconnect and popen then working like their non persistent
  214. * equivalents.
  215. *
  216. * @param string $host can be a host, or the path to a unix domain socket
  217. * @param int $port optional
  218. * @param float $timeout value in seconds (optional, default is 0 meaning unlimited)
  219. * @param string $persistentId identity for the requested persistent connection
  220. * @param int $retryInterval retry interval in milliseconds.
  221. * @param float $readTimeout value in seconds (optional, default is 0 meaning unlimited)
  222. *
  223. * @return bool TRUE on success, FALSE on ertcnror.
  224. *
  225. * @example
  226. * <pre>
  227. * $redis->pconnect('127.0.0.1', 6379);
  228. *
  229. * // port 6379 by default - same connection like before
  230. * $redis->pconnect('127.0.0.1');
  231. *
  232. * // 2.5 sec timeout and would be another connection than the two before.
  233. * $redis->pconnect('127.0.0.1', 6379, 2.5);
  234. *
  235. * // x is sent as persistent_id and would be another connection than the three before.
  236. * $redis->pconnect('127.0.0.1', 6379, 2.5, 'x');
  237. *
  238. * // unix domain socket - would be another connection than the four before.
  239. * $redis->pconnect('/tmp/redis.sock');
  240. * </pre>
  241. */
  242. public function pconnect(
  243. $host,
  244. $port = 6379,
  245. $timeout = 0.0,
  246. $persistentId = null,
  247. $retryInterval = 0,
  248. $readTimeout = 0.0
  249. ) {
  250. }
  251. /**
  252. * @param string $host
  253. * @param int $port
  254. * @param float $timeout
  255. * @param string $persistentId
  256. * @param int $retryInterval
  257. * @param float $readTimeout
  258. *
  259. * @return bool
  260. *
  261. * @deprecated use Redis::pconnect()
  262. * @see pconnect()
  263. */
  264. public function popen(
  265. $host,
  266. $port = 6379,
  267. $timeout = 0.0,
  268. $persistentId = '',
  269. $retryInterval = 0,
  270. $readTimeout = 0.0
  271. ) {
  272. }
  273. /**
  274. * Disconnects from the Redis instance.
  275. *
  276. * Note: Closing a persistent connection requires PhpRedis >= 4.2.0
  277. *
  278. * @since >= 4.2 Closing a persistent connection requires PhpRedis
  279. *
  280. * @return bool TRUE on success, FALSE on error
  281. */
  282. public function close()
  283. {
  284. }
  285. /**
  286. * Swap one Redis database with another atomically
  287. *
  288. * Note: Requires Redis >= 4.0.0
  289. *
  290. * @param int $db1
  291. * @param int $db2
  292. *
  293. * @return bool TRUE on success and FALSE on failure
  294. *
  295. * @link https://redis.io/commands/swapdb
  296. * @since >= 4.0
  297. * @example
  298. * <pre>
  299. * // Swaps DB 0 with DB 1 atomically
  300. * $redis->swapdb(0, 1);
  301. * </pre>
  302. */
  303. public function swapdb(int $db1, int $db2)
  304. {
  305. }
  306. /**
  307. * Set client option
  308. *
  309. * @param int $option option name
  310. * @param mixed $value option value
  311. *
  312. * @return bool TRUE on success, FALSE on error
  313. *
  314. * @example
  315. * <pre>
  316. * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE); // don't serialize data
  317. * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP); // use built-in serialize/unserialize
  318. * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY); // use igBinary serialize/unserialize
  319. * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_MSGPACK); // Use msgpack serialize/unserialize
  320. * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_JSON); // Use json serialize/unserialize
  321. *
  322. * $redis->setOption(Redis::OPT_PREFIX, 'myAppName:'); // use custom prefix on all keys
  323. *
  324. * // Options for the SCAN family of commands, indicating whether to abstract
  325. * // empty results from the user. If set to SCAN_NORETRY (the default), phpredis
  326. * // will just issue one SCAN command at a time, sometimes returning an empty
  327. * // array of results. If set to SCAN_RETRY, phpredis will retry the scan command
  328. * // until keys come back OR Redis returns an iterator of zero
  329. * $redis->setOption(Redis::OPT_SCAN, Redis::SCAN_NORETRY);
  330. * $redis->setOption(Redis::OPT_SCAN, Redis::SCAN_RETRY);
  331. * </pre>
  332. */
  333. public function setOption($option, $value)
  334. {
  335. }
  336. /**
  337. * Get client option
  338. *
  339. * @param int $option parameter name
  340. *
  341. * @return mixed|null Parameter value
  342. *
  343. * @see setOption()
  344. * @example
  345. * // return option value
  346. * $redis->getOption(Redis::OPT_SERIALIZER);
  347. */
  348. public function getOption($option)
  349. {
  350. }
  351. /**
  352. * Check the current connection status
  353. *
  354. * @param string $message
  355. *
  356. * @return bool|string TRUE if the command is successful or returns message
  357. * Throws a RedisException object on connectivity error, as described above.
  358. * @throws RedisException
  359. * @link https://redis.io/commands/ping
  360. */
  361. public function ping($message)
  362. {
  363. }
  364. /**
  365. * Echo the given string
  366. *
  367. * @param string $message
  368. *
  369. * @return string Returns message
  370. *
  371. * @link https://redis.io/commands/echo
  372. */
  373. public function echo($message)
  374. {
  375. }
  376. /**
  377. * Get the value related to the specified key
  378. *
  379. * @param string $key
  380. *
  381. * @return string|mixed|bool If key didn't exist, FALSE is returned.
  382. * Otherwise, the value related to this key is returned
  383. *
  384. * @link https://redis.io/commands/get
  385. * @example
  386. * <pre>
  387. * $redis->set('key', 'hello');
  388. * $redis->get('key');
  389. *
  390. * // set and get with serializer
  391. * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_JSON);
  392. *
  393. * $redis->set('key', ['asd' => 'as', 'dd' => 123, 'b' => true]);
  394. * var_dump($redis->get('key'));
  395. * // Output:
  396. * array(3) {
  397. * 'asd' => string(2) "as"
  398. * 'dd' => int(123)
  399. * 'b' => bool(true)
  400. * }
  401. * </pre>
  402. */
  403. public function get($key)
  404. {
  405. }
  406. /**
  407. * Set the string value in argument as value of the key.
  408. *
  409. * @since If you're using Redis >= 2.6.12, you can pass extended options as explained in example
  410. *
  411. * @param string $key
  412. * @param string|mixed $value string if not used serializer
  413. * @param int|array $timeout [optional] Calling setex() is preferred if you want a timeout.<br>
  414. * Since 2.6.12 it also supports different flags inside an array. Example ['NX', 'EX' => 60]<br>
  415. * - EX seconds -- Set the specified expire time, in seconds.<br>
  416. * - PX milliseconds -- Set the specified expire time, in milliseconds.<br>
  417. * - NX -- Only set the key if it does not already exist.<br>
  418. * - XX -- Only set the key if it already exist.<br>
  419. * <pre>
  420. * // Simple key -> value set
  421. * $redis->set('key', 'value');
  422. *
  423. * // Will redirect, and actually make an SETEX call
  424. * $redis->set('key','value', 10);
  425. *
  426. * // Will set the key, if it doesn't exist, with a ttl of 10 seconds
  427. * $redis->set('key', 'value', ['nx', 'ex' => 10]);
  428. *
  429. * // Will set a key, if it does exist, with a ttl of 1000 milliseconds
  430. * $redis->set('key', 'value', ['xx', 'px' => 1000]);
  431. * </pre>
  432. *
  433. * @return bool TRUE if the command is successful
  434. *
  435. * @link https://redis.io/commands/set
  436. */
  437. public function set($key, $value, $timeout = null)
  438. {
  439. }
  440. /**
  441. * Set the string value in argument as value of the key, with a time to live.
  442. *
  443. * @param string $key
  444. * @param int $ttl
  445. * @param string|mixed $value
  446. *
  447. * @return bool TRUE if the command is successful
  448. *
  449. * @link https://redis.io/commands/setex
  450. * @example $redis->setex('key', 3600, 'value'); // sets key → value, with 1h TTL.
  451. */
  452. public function setex($key, $ttl, $value)
  453. {
  454. }
  455. /**
  456. * Set the value and expiration in milliseconds of a key.
  457. *
  458. * @see setex()
  459. * @param string $key
  460. * @param int $ttl, in milliseconds.
  461. * @param string|mixed $value
  462. *
  463. * @return bool TRUE if the command is successful
  464. *
  465. * @link https://redis.io/commands/psetex
  466. * @example $redis->psetex('key', 1000, 'value'); // sets key → value, with 1sec TTL.
  467. */
  468. public function psetex($key, $ttl, $value)
  469. {
  470. }
  471. /**
  472. * Set the string value in argument as value of the key if the key doesn't already exist in the database.
  473. *
  474. * @param string $key
  475. * @param string|mixed $value
  476. *
  477. * @return bool TRUE in case of success, FALSE in case of failure
  478. *
  479. * @link https://redis.io/commands/setnx
  480. * @example
  481. * <pre>
  482. * $redis->setnx('key', 'value'); // return TRUE
  483. * $redis->setnx('key', 'value'); // return FALSE
  484. * </pre>
  485. */
  486. public function setnx($key, $value)
  487. {
  488. }
  489. /**
  490. * Remove specified keys.
  491. *
  492. * @param int|string|array $key1 An array of keys, or an undefined number of parameters, each a key: key1 key2 key3 ... keyN
  493. * @param int|string ...$otherKeys
  494. *
  495. * @return int Number of keys deleted
  496. *
  497. * @link https://redis.io/commands/del
  498. * @example
  499. * <pre>
  500. * $redis->set('key1', 'val1');
  501. * $redis->set('key2', 'val2');
  502. * $redis->set('key3', 'val3');
  503. * $redis->set('key4', 'val4');
  504. *
  505. * $redis->del('key1', 'key2'); // return 2
  506. * $redis->del(['key3', 'key4']); // return 2
  507. * </pre>
  508. */
  509. public function del($key1, ...$otherKeys)
  510. {
  511. }
  512. /**
  513. * @see del()
  514. * @deprecated use Redis::del()
  515. *
  516. * @param string|string[] $key1
  517. * @param string $key2
  518. * @param string $key3
  519. *
  520. * @return int Number of keys deleted
  521. */
  522. public function delete($key1, $key2 = null, $key3 = null)
  523. {
  524. }
  525. /**
  526. * Delete a key asynchronously in another thread. Otherwise it is just as DEL, but non blocking.
  527. *
  528. * @see del()
  529. * @param string|string[] $key1
  530. * @param string $key2
  531. * @param string $key3
  532. *
  533. * @return int Number of keys unlinked.
  534. *
  535. * @link https://redis.io/commands/unlink
  536. * @example
  537. * <pre>
  538. * $redis->set('key1', 'val1');
  539. * $redis->set('key2', 'val2');
  540. * $redis->set('key3', 'val3');
  541. * $redis->set('key4', 'val4');
  542. * $redis->unlink('key1', 'key2'); // return 2
  543. * $redis->unlink(array('key3', 'key4')); // return 2
  544. * </pre>
  545. */
  546. public function unlink($key1, $key2 = null, $key3 = null)
  547. {
  548. }
  549. /**
  550. * Enter and exit transactional mode.
  551. *
  552. * @param int $mode Redis::MULTI|Redis::PIPELINE
  553. * Defaults to Redis::MULTI.
  554. * A Redis::MULTI block of commands runs as a single transaction;
  555. * a Redis::PIPELINE block is simply transmitted faster to the server, but without any guarantee of atomicity.
  556. * discard cancels a transaction.
  557. *
  558. * @return Redis returns the Redis instance and enters multi-mode.
  559. * Once in multi-mode, all subsequent method calls return the same object until exec() is called.
  560. *
  561. * @link https://redis.io/commands/multi
  562. * @example
  563. * <pre>
  564. * $ret = $redis->multi()
  565. * ->set('key1', 'val1')
  566. * ->get('key1')
  567. * ->set('key2', 'val2')
  568. * ->get('key2')
  569. * ->exec();
  570. *
  571. * //$ret == array (
  572. * // 0 => TRUE,
  573. * // 1 => 'val1',
  574. * // 2 => TRUE,
  575. * // 3 => 'val2');
  576. * </pre>
  577. */
  578. public function multi($mode = Redis::MULTI)
  579. {
  580. }
  581. /**
  582. * Returns a Redis instance which can simply transmitted faster to the server.
  583. *
  584. * @return Redis returns the Redis instance.
  585. * Once in pipeline-mode, all subsequent method calls return the same object until exec() is called.
  586. * Pay attention, that Pipeline is not a transaction, so you can get unexpected
  587. * results in case of big pipelines and small read/write timeouts.
  588. *
  589. * @link https://redis.io/topics/pipelining
  590. * @example
  591. * <pre>
  592. * $ret = $this->redis->pipeline()
  593. * ->ping()
  594. * ->multi()->set('x', 42)->incr('x')->exec()
  595. * ->ping()
  596. * ->multi()->get('x')->del('x')->exec()
  597. * ->ping()
  598. * ->exec();
  599. *
  600. * //$ret == array (
  601. * // 0 => '+PONG',
  602. * // 1 => [TRUE, 43],
  603. * // 2 => '+PONG',
  604. * // 3 => [43, 1],
  605. * // 4 => '+PONG');
  606. * </pre>
  607. */
  608. public function pipeline()
  609. {
  610. }
  611. /**
  612. * @return void|array
  613. *
  614. * @see multi()
  615. * @link https://redis.io/commands/exec
  616. */
  617. public function exec()
  618. {
  619. }
  620. /**
  621. * @see multi()
  622. * @link https://redis.io/commands/discard
  623. */
  624. public function discard()
  625. {
  626. }
  627. /**
  628. * Watches a key for modifications by another client. If the key is modified between WATCH and EXEC,
  629. * the MULTI/EXEC transaction will fail (return FALSE). unwatch cancels all the watching of all keys by this client.
  630. * @param string|string[] $key a list of keys
  631. *
  632. * @return void
  633. *
  634. * @link https://redis.io/commands/watch
  635. * @example
  636. * <pre>
  637. * $redis->watch('x');
  638. * // long code here during the execution of which other clients could well modify `x`
  639. * $ret = $redis->multi()
  640. * ->incr('x')
  641. * ->exec();
  642. * // $ret = FALSE if x has been modified between the call to WATCH and the call to EXEC.
  643. * </pre>
  644. */
  645. public function watch($key)
  646. {
  647. }
  648. /**
  649. * @see watch()
  650. * @link https://redis.io/commands/unwatch
  651. */
  652. public function unwatch()
  653. {
  654. }
  655. /**
  656. * Subscribe to channels.
  657. *
  658. * Warning: this function will probably change in the future.
  659. *
  660. * @param string[] $channels an array of channels to subscribe
  661. * @param string|array $callback either a string or an array($instance, 'method_name').
  662. * The callback function receives 3 parameters: the redis instance, the channel name, and the message.
  663. *
  664. * @return mixed|null Any non-null return value in the callback will be returned to the caller.
  665. *
  666. * @link https://redis.io/commands/subscribe
  667. * @example
  668. * <pre>
  669. * function f($redis, $chan, $msg) {
  670. * switch($chan) {
  671. * case 'chan-1':
  672. * ...
  673. * break;
  674. *
  675. * case 'chan-2':
  676. * ...
  677. * break;
  678. *
  679. * case 'chan-2':
  680. * ...
  681. * break;
  682. * }
  683. * }
  684. *
  685. * $redis->subscribe(array('chan-1', 'chan-2', 'chan-3'), 'f'); // subscribe to 3 chans
  686. * </pre>
  687. */
  688. public function subscribe($channels, $callback)
  689. {
  690. }
  691. /**
  692. * Subscribe to channels by pattern
  693. *
  694. * @param array $patterns an array of glob-style patterns to subscribe
  695. * @param string|array $callback Either a string or an array with an object and method.
  696. * The callback will get four arguments ($redis, $pattern, $channel, $message)
  697. * @param mixed Any non-null return value in the callback will be returned to the caller
  698. *
  699. * @link https://redis.io/commands/psubscribe
  700. * @example
  701. * <pre>
  702. * function psubscribe($redis, $pattern, $chan, $msg) {
  703. * echo "Pattern: $pattern\n";
  704. * echo "Channel: $chan\n";
  705. * echo "Payload: $msg\n";
  706. * }
  707. * </pre>
  708. */
  709. public function psubscribe($patterns, $callback)
  710. {
  711. }
  712. /**
  713. * Publish messages to channels.
  714. *
  715. * Warning: this function will probably change in the future.
  716. *
  717. * @param string $channel a channel to publish to
  718. * @param string $message string
  719. *
  720. * @return int Number of clients that received the message
  721. *
  722. * @link https://redis.io/commands/publish
  723. * @example $redis->publish('chan-1', 'hello, world!'); // send message.
  724. */
  725. public function publish($channel, $message)
  726. {
  727. }
  728. /**
  729. * A command allowing you to get information on the Redis pub/sub system
  730. *
  731. * @param string $keyword String, which can be: "channels", "numsub", or "numpat"
  732. * @param string|array $argument Optional, variant.
  733. * For the "channels" subcommand, you can pass a string pattern.
  734. * For "numsub" an array of channel names
  735. *
  736. * @return array|int Either an integer or an array.
  737. * - channels Returns an array where the members are the matching channels.
  738. * - numsub Returns a key/value array where the keys are channel names and
  739. * values are their counts.
  740. * - numpat Integer return containing the number active pattern subscriptions
  741. *
  742. * @link https://redis.io/commands/pubsub
  743. * @example
  744. * <pre>
  745. * $redis->pubsub('channels'); // All channels
  746. * $redis->pubsub('channels', '*pattern*'); // Just channels matching your pattern
  747. * $redis->pubsub('numsub', array('chan1', 'chan2')); // Get subscriber counts for 'chan1' and 'chan2'
  748. * $redis->pubsub('numpat'); // Get the number of pattern subscribers
  749. * </pre>
  750. */
  751. public function pubsub($keyword, $argument)
  752. {
  753. }
  754. /**
  755. * Stop listening for messages posted to the given channels.
  756. *
  757. * @param array $channels an array of channels to usubscribe
  758. *
  759. * @link https://redis.io/commands/unsubscribe
  760. */
  761. public function unsubscribe($channels = null)
  762. {
  763. }
  764. /**
  765. * Stop listening for messages posted to the given channels.
  766. *
  767. * @param array $patterns an array of glob-style patterns to unsubscribe
  768. *
  769. * @link https://redis.io/commands/punsubscribe
  770. */
  771. public function punsubscribe($patterns = null)
  772. {
  773. }
  774. /**
  775. * Verify if the specified key/keys exists
  776. *
  777. * This function took a single argument and returned TRUE or FALSE in phpredis versions < 4.0.0.
  778. *
  779. * @since >= 4.0 Returned int, if < 4.0 returned bool
  780. *
  781. * @param string|string[] $key
  782. *
  783. * @return int|bool The number of keys tested that do exist
  784. *
  785. * @link https://redis.io/commands/exists
  786. * @link https://github.com/phpredis/phpredis#exists
  787. * @example
  788. * <pre>
  789. * $redis->exists('key'); // 1
  790. * $redis->exists('NonExistingKey'); // 0
  791. *
  792. * $redis->mset(['foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz']);
  793. * $redis->exists(['foo', 'bar', 'baz]); // 3
  794. * $redis->exists('foo', 'bar', 'baz'); // 3
  795. * </pre>
  796. */
  797. public function exists($key)
  798. {
  799. }
  800. /**
  801. * Increment the number stored at key by one.
  802. *
  803. * @param string $key
  804. *
  805. * @return int the new value
  806. *
  807. * @link https://redis.io/commands/incr
  808. * @example
  809. * <pre>
  810. * $redis->incr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value 1
  811. * $redis->incr('key1'); // 2
  812. * $redis->incr('key1'); // 3
  813. * $redis->incr('key1'); // 4
  814. * </pre>
  815. */
  816. public function incr($key)
  817. {
  818. }
  819. /**
  820. * Increment the float value of a key by the given amount
  821. *
  822. * @param string $key
  823. * @param float $increment
  824. *
  825. * @return float
  826. *
  827. * @link https://redis.io/commands/incrbyfloat
  828. * @example
  829. * <pre>
  830. * $redis->set('x', 3);
  831. * $redis->incrByFloat('x', 1.5); // float(4.5)
  832. * $redis->get('x'); // float(4.5)
  833. * </pre>
  834. */
  835. public function incrByFloat($key, $increment)
  836. {
  837. }
  838. /**
  839. * Increment the number stored at key by one.
  840. * If the second argument is filled, it will be used as the integer value of the increment.
  841. *
  842. * @param string $key key
  843. * @param int $value value that will be added to key (only for incrBy)
  844. *
  845. * @return int the new value
  846. *
  847. * @link https://redis.io/commands/incrby
  848. * @example
  849. * <pre>
  850. * $redis->incr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value 1
  851. * $redis->incr('key1'); // 2
  852. * $redis->incr('key1'); // 3
  853. * $redis->incr('key1'); // 4
  854. * $redis->incrBy('key1', 10); // 14
  855. * </pre>
  856. */
  857. public function incrBy($key, $value)
  858. {
  859. }
  860. /**
  861. * Decrement the number stored at key by one.
  862. *
  863. * @param string $key
  864. *
  865. * @return int the new value
  866. *
  867. * @link https://redis.io/commands/decr
  868. * @example
  869. * <pre>
  870. * $redis->decr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value -1
  871. * $redis->decr('key1'); // -2
  872. * $redis->decr('key1'); // -3
  873. * </pre>
  874. */
  875. public function decr($key)
  876. {
  877. }
  878. /**
  879. * Decrement the number stored at key by one.
  880. * If the second argument is filled, it will be used as the integer value of the decrement.
  881. *
  882. * @param string $key
  883. * @param int $value that will be subtracted to key (only for decrBy)
  884. *
  885. * @return int the new value
  886. *
  887. * @link https://redis.io/commands/decrby
  888. * @example
  889. * <pre>
  890. * $redis->decr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value -1
  891. * $redis->decr('key1'); // -2
  892. * $redis->decr('key1'); // -3
  893. * $redis->decrBy('key1', 10); // -13
  894. * </pre>
  895. */
  896. public function decrBy($key, $value)
  897. {
  898. }
  899. /**
  900. * Adds the string values to the head (left) of the list.
  901. * Creates the list if the key didn't exist.
  902. * If the key exists and is not a list, FALSE is returned.
  903. *
  904. * @param string $key
  905. * @param string|mixed $value1... Variadic list of values to push in key, if dont used serialized, used string
  906. *
  907. * @return int|bool The new length of the list in case of success, FALSE in case of Failure
  908. *
  909. * @link https://redis.io/commands/lpush
  910. * @example
  911. * <pre>
  912. * $redis->lPush('l', 'v1', 'v2', 'v3', 'v4') // int(4)
  913. * var_dump( $redis->lRange('l', 0, -1) );
  914. * // Output:
  915. * // array(4) {
  916. * // [0]=> string(2) "v4"
  917. * // [1]=> string(2) "v3"
  918. * // [2]=> string(2) "v2"
  919. * // [3]=> string(2) "v1"
  920. * // }
  921. * </pre>
  922. */
  923. public function lPush($key, ...$value1)
  924. {
  925. }
  926. /**
  927. * Adds the string values to the tail (right) of the list.
  928. * Creates the list if the key didn't exist.
  929. * If the key exists and is not a list, FALSE is returned.
  930. *
  931. * @param string $key
  932. * @param string|mixed $value1... Variadic list of values to push in key, if dont used serialized, used string
  933. *
  934. * @return int|bool The new length of the list in case of success, FALSE in case of Failure
  935. *
  936. * @link https://redis.io/commands/rpush
  937. * @example
  938. * <pre>
  939. * $redis->rPush('l', 'v1', 'v2', 'v3', 'v4'); // int(4)
  940. * var_dump( $redis->lRange('l', 0, -1) );
  941. * // Output:
  942. * // array(4) {
  943. * // [0]=> string(2) "v1"
  944. * // [1]=> string(2) "v2"
  945. * // [2]=> string(2) "v3"
  946. * // [3]=> string(2) "v4"
  947. * // }
  948. * </pre>
  949. */
  950. public function rPush($key, ...$value1)
  951. {
  952. }
  953. /**
  954. * Adds the string value to the head (left) of the list if the list exists.
  955. *
  956. * @param string $key
  957. * @param string|mixed $value String, value to push in key
  958. *
  959. * @return int|bool The new length of the list in case of success, FALSE in case of Failure.
  960. *
  961. * @link https://redis.io/commands/lpushx
  962. * @example
  963. * <pre>
  964. * $redis->del('key1');
  965. * $redis->lPushx('key1', 'A'); // returns 0
  966. * $redis->lPush('key1', 'A'); // returns 1
  967. * $redis->lPushx('key1', 'B'); // returns 2
  968. * $redis->lPushx('key1', 'C'); // returns 3
  969. * // key1 now points to the following list: [ 'A', 'B', 'C' ]
  970. * </pre>
  971. */
  972. public function lPushx($key, $value)
  973. {
  974. }
  975. /**
  976. * Adds the string value to the tail (right) of the list if the ist exists. FALSE in case of Failure.
  977. *
  978. * @param string $key
  979. * @param string|mixed $value String, value to push in key
  980. *
  981. * @return int|bool The new length of the list in case of success, FALSE in case of Failure.
  982. *
  983. * @link https://redis.io/commands/rpushx
  984. * @example
  985. * <pre>
  986. * $redis->del('key1');
  987. * $redis->rPushx('key1', 'A'); // returns 0
  988. * $redis->rPush('key1', 'A'); // returns 1
  989. * $redis->rPushx('key1', 'B'); // returns 2
  990. * $redis->rPushx('key1', 'C'); // returns 3
  991. * // key1 now points to the following list: [ 'A', 'B', 'C' ]
  992. * </pre>
  993. */
  994. public function rPushx($key, $value)
  995. {
  996. }
  997. /**
  998. * Returns and removes the first element of the list.
  999. *
  1000. * @param string $key
  1001. *
  1002. * @return mixed|bool if command executed successfully BOOL FALSE in case of failure (empty list)
  1003. *
  1004. * @link https://redis.io/commands/lpop
  1005. * @example
  1006. * <pre>
  1007. * $redis->rPush('key1', 'A');
  1008. * $redis->rPush('key1', 'B');
  1009. * $redis->rPush('key1', 'C'); // key1 => [ 'A', 'B', 'C' ]
  1010. * $redis->lPop('key1'); // key1 => [ 'B', 'C' ]
  1011. * </pre>
  1012. */
  1013. public function lPop($key)
  1014. {
  1015. }
  1016. /**
  1017. * Returns and removes the last element of the list.
  1018. *
  1019. * @param string $key
  1020. *
  1021. * @return mixed|bool if command executed successfully BOOL FALSE in case of failure (empty list)
  1022. *
  1023. * @link https://redis.io/commands/rpop
  1024. * @example
  1025. * <pre>
  1026. * $redis->rPush('key1', 'A');
  1027. * $redis->rPush('key1', 'B');
  1028. * $redis->rPush('key1', 'C'); // key1 => [ 'A', 'B', 'C' ]
  1029. * $redis->rPop('key1'); // key1 => [ 'A', 'B' ]
  1030. * </pre>
  1031. */
  1032. public function rPop($key)
  1033. {
  1034. }
  1035. /**
  1036. * Is a blocking lPop primitive. If at least one of the lists contains at least one element,
  1037. * the element will be popped from the head of the list and returned to the caller.
  1038. * Il all the list identified by the keys passed in arguments are empty, blPop will block
  1039. * during the specified timeout until an element is pushed to one of those lists. This element will be popped.
  1040. *
  1041. * @param string|string[] $keys String array containing the keys of the lists OR variadic list of strings
  1042. * @param int $timeout Timeout is always the required final parameter
  1043. *
  1044. * @return array ['listName', 'element']
  1045. *
  1046. * @link https://redis.io/commands/blpop
  1047. * @example
  1048. * <pre>
  1049. * // Non blocking feature
  1050. * $redis->lPush('key1', 'A');
  1051. * $redis->del('key2');
  1052. *
  1053. * $redis->blPop('key1', 'key2', 10); // array('key1', 'A')
  1054. * // OR
  1055. * $redis->blPop(['key1', 'key2'], 10); // array('key1', 'A')
  1056. *
  1057. * $redis->brPop('key1', 'key2', 10); // array('key1', 'A')
  1058. * // OR
  1059. * $redis->brPop(['key1', 'key2'], 10); // array('key1', 'A')
  1060. *
  1061. * // Blocking feature
  1062. *
  1063. * // process 1
  1064. * $redis->del('key1');
  1065. * $redis->blPop('key1', 10);
  1066. * // blocking for 10 seconds
  1067. *
  1068. * // process 2
  1069. * $redis->lPush('key1', 'A');
  1070. *
  1071. * // process 1
  1072. * // array('key1', 'A') is returned
  1073. * </pre>
  1074. */
  1075. public function blPop($keys, $timeout)
  1076. {
  1077. }
  1078. /**
  1079. * Is a blocking rPop primitive. If at least one of the lists contains at least one element,
  1080. * the element will be popped from the head of the list and returned to the caller.
  1081. * Il all the list identified by the keys passed in arguments are empty, brPop will
  1082. * block during the specified timeout until an element is pushed to one of those lists. T
  1083. * his element will be popped.
  1084. *
  1085. * @param string|string[] $keys String array containing the keys of the lists OR variadic list of strings
  1086. * @param int $timeout Timeout is always the required final parameter
  1087. *
  1088. * @return array ['listName', 'element']
  1089. *
  1090. * @link https://redis.io/commands/brpop
  1091. * @example
  1092. * <pre>
  1093. * // Non blocking feature
  1094. * $redis->lPush('key1', 'A');
  1095. * $redis->del('key2');
  1096. *
  1097. * $redis->blPop('key1', 'key2', 10); // array('key1', 'A')
  1098. * // OR
  1099. * $redis->blPop(array('key1', 'key2'), 10); // array('key1', 'A')
  1100. *
  1101. * $redis->brPop('key1', 'key2', 10); // array('key1', 'A')
  1102. * // OR
  1103. * $redis->brPop(array('key1', 'key2'), 10); // array('key1', 'A')
  1104. *
  1105. * // Blocking feature
  1106. *
  1107. * // process 1
  1108. * $redis->del('key1');
  1109. * $redis->blPop('key1', 10);
  1110. * // blocking for 10 seconds
  1111. *
  1112. * // process 2
  1113. * $redis->lPush('key1', 'A');
  1114. *
  1115. * // process 1
  1116. * // array('key1', 'A') is returned
  1117. * </pre>
  1118. */
  1119. public function brPop(array $keys, $timeout)
  1120. {
  1121. }
  1122. /**
  1123. * Returns the size of a list identified by Key. If the list didn't exist or is empty,
  1124. * the command returns 0. If the data type identified by Key is not a list, the command return FALSE.
  1125. *
  1126. * @param string $key
  1127. *
  1128. * @return int|bool The size of the list identified by Key exists.
  1129. * bool FALSE if the data type identified by Key is not list
  1130. *
  1131. * @link https://redis.io/commands/llen
  1132. * @example
  1133. * <pre>
  1134. * $redis->rPush('key1', 'A');
  1135. * $redis->rPush('key1', 'B');
  1136. * $redis->rPush('key1', 'C'); // key1 => [ 'A', 'B', 'C' ]
  1137. * $redis->lLen('key1'); // 3
  1138. * $redis->rPop('key1');
  1139. * $redis->lLen('key1'); // 2
  1140. * </pre>
  1141. */
  1142. public function lLen($key)
  1143. {
  1144. }
  1145. /**
  1146. * @see lLen()
  1147. * @link https://redis.io/commands/llen
  1148. * @deprecated use Redis::lLen()
  1149. *
  1150. * @param string $key
  1151. *
  1152. * @return int The size of the list identified by Key exists
  1153. */
  1154. public function lSize($key)
  1155. {
  1156. }
  1157. /**
  1158. * Return the specified element of the list stored at the specified key.
  1159. * 0 the first element, 1 the second ... -1 the last element, -2 the penultimate ...
  1160. * Return FALSE in case of a bad index or a key that doesn't point to a list.
  1161. *
  1162. * @param string $key
  1163. * @param int $index
  1164. *
  1165. * @return mixed|bool the element at this index
  1166. *
  1167. * Bool FALSE if the key identifies a non-string data type, or no value corresponds to this index in the list Key.
  1168. *
  1169. * @link https://redis.io/commands/lindex
  1170. * @example
  1171. * <pre>
  1172. * $redis->rPush('key1', 'A');
  1173. * $redis->rPush('key1', 'B');
  1174. * $redis->rPush('key1', 'C'); // key1 => [ 'A', 'B', 'C' ]
  1175. * $redis->lIndex('key1', 0); // 'A'
  1176. * $redis->lIndex('key1', -1); // 'C'
  1177. * $redis->lIndex('key1', 10); // `FALSE`
  1178. * </pre>
  1179. */
  1180. public function lIndex($key, $index)
  1181. {
  1182. }
  1183. /**
  1184. * @see lIndex()
  1185. * @link https://redis.io/commands/lindex
  1186. * @deprecated use Redis::lIndex()
  1187. *
  1188. * @param string $key
  1189. * @param int $index
  1190. * @return mixed|bool the element at this index
  1191. */
  1192. public function lGet($key, $index)
  1193. {
  1194. }
  1195. /**
  1196. * Set the list at index with the new value.
  1197. *
  1198. * @param string $key
  1199. * @param int $index
  1200. * @param string $value
  1201. *
  1202. * @return bool TRUE if the new value is setted.
  1203. * FALSE if the index is out of range, or data type identified by key is not a list.
  1204. *
  1205. * @link https://redis.io/commands/lset
  1206. * @example
  1207. * <pre>
  1208. * $redis->rPush('key1', 'A');
  1209. * $redis->rPush('key1', 'B');
  1210. * $redis->rPush('key1', 'C'); // key1 => [ 'A', 'B', 'C' ]
  1211. * $redis->lIndex('key1', 0); // 'A'
  1212. * $redis->lSet('key1', 0, 'X');
  1213. * $redis->lIndex('key1', 0); // 'X'
  1214. * </pre>
  1215. */
  1216. public function lSet($key, $index, $value)
  1217. {
  1218. }
  1219. /**
  1220. * Returns the specified elements of the list stored at the specified key in
  1221. * the range [start, end]. start and stop are interpretated as indices: 0 the first element,
  1222. * 1 the second ... -1 the last element, -2 the penultimate ...
  1223. *
  1224. * @param string $key
  1225. * @param int $start
  1226. * @param int $end
  1227. *
  1228. * @return array containing the values in specified range.
  1229. *
  1230. * @link https://redis.io/commands/lrange
  1231. * @example
  1232. * <pre>
  1233. * $redis->rPush('key1', 'A');
  1234. * $redis->rPush('key1', 'B');
  1235. * $redis->rPush('key1', 'C');
  1236. * $redis->lRange('key1', 0, -1); // array('A', 'B', 'C')
  1237. * </pre>
  1238. */
  1239. public function lRange($key, $start, $end)
  1240. {
  1241. }
  1242. /**
  1243. * @see lRange()
  1244. * @link https://redis.io/commands/lrange
  1245. * @deprecated use Redis::lRange()
  1246. *
  1247. * @param string $key
  1248. * @param int $start
  1249. * @param int $end
  1250. * @return array
  1251. */
  1252. public function lGetRange($key, $start, $end)
  1253. {
  1254. }
  1255. /**
  1256. * Trims an existing list so that it will contain only a specified range of elements.
  1257. *
  1258. * @param string $key
  1259. * @param int $start
  1260. * @param int $stop
  1261. *
  1262. * @return array|bool Bool return FALSE if the key identify a non-list value
  1263. *
  1264. * @link https://redis.io/commands/ltrim
  1265. * @example
  1266. * <pre>
  1267. * $redis->rPush('key1', 'A');
  1268. * $redis->rPush('key1', 'B');
  1269. * $redis->rPush('key1', 'C');
  1270. * $redis->lRange('key1', 0, -1); // array('A', 'B', 'C')
  1271. * $redis->lTrim('key1', 0, 1);
  1272. * $redis->lRange('key1', 0, -1); // array('A', 'B')
  1273. * </pre>
  1274. */
  1275. public function lTrim($key, $start, $stop)
  1276. {
  1277. }
  1278. /**
  1279. * @see lTrim()
  1280. * @link https://redis.io/commands/ltrim
  1281. * @deprecated use Redis::lTrim()
  1282. *
  1283. * @param string $key
  1284. * @param int $start
  1285. * @param int $stop
  1286. */
  1287. public function listTrim($key, $start, $stop)
  1288. {
  1289. }
  1290. /**
  1291. * Removes the first count occurrences of the value element from the list.
  1292. * If count is zero, all the matching elements are removed. If count is negative,
  1293. * elements are removed from tail to head.
  1294. *
  1295. * @param string $key
  1296. * @param string $value
  1297. * @param int $count
  1298. *
  1299. * @return int|bool the number of elements to remove
  1300. * bool FALSE if the value identified by key is not a list.
  1301. *
  1302. * @link https://redis.io/commands/lrem
  1303. * @example
  1304. * <pre>
  1305. * $redis->lPush('key1', 'A');
  1306. * $redis->lPush('key1', 'B');
  1307. * $redis->lPush('key1', 'C');
  1308. * $redis->lPush('key1', 'A');
  1309. * $redis->lPush('key1', 'A');
  1310. *
  1311. * $redis->lRange('key1', 0, -1); // array('A', 'A', 'C', 'B', 'A')
  1312. * $redis->lRem('key1', 'A', 2); // 2
  1313. * $redis->lRange('key1', 0, -1); // array('C', 'B', 'A')
  1314. * </pre>
  1315. */
  1316. public function lRem($key, $value, $count)
  1317. {
  1318. }
  1319. /**
  1320. * @see lRem
  1321. * @link https://redis.io/commands/lremove
  1322. * @deprecated use Redis::lRem()
  1323. *
  1324. * @param string $key
  1325. * @param string $value
  1326. * @param int $count
  1327. */
  1328. public function lRemove($key, $value, $count)
  1329. {
  1330. }
  1331. /**
  1332. * Insert value in the list before or after the pivot value. the parameter options
  1333. * specify the position of the insert (before or after). If the list didn't exists,
  1334. * or the pivot didn't exists, the value is not inserted.
  1335. *
  1336. * @param string $key
  1337. * @param int $position Redis::BEFORE | Redis::AFTER
  1338. * @param string $pivot
  1339. * @param string|mixed $value
  1340. *
  1341. * @return int The number of the elements in the list, -1 if the pivot didn't exists.
  1342. *
  1343. * @link https://redis.io/commands/linsert
  1344. * @example
  1345. * <pre>
  1346. * $redis->del('key1');
  1347. * $redis->lInsert('key1', Redis::AFTER, 'A', 'X'); // 0
  1348. *
  1349. * $redis->lPush('key1', 'A');
  1350. * $redis->lPush('key1', 'B');
  1351. * $redis->lPush('key1', 'C');
  1352. *
  1353. * $redis->lInsert('key1', Redis::BEFORE, 'C', 'X'); // 4
  1354. * $redis->lRange('key1', 0, -1); // array('A', 'B', 'X', 'C')
  1355. *
  1356. * $redis->lInsert('key1', Redis::AFTER, 'C', 'Y'); // 5
  1357. * $redis->lRange('key1', 0, -1); // array('A', 'B', 'X', 'C', 'Y')
  1358. *
  1359. * $redis->lInsert('key1', Redis::AFTER, 'W', 'value'); // -1
  1360. * </pre>
  1361. */
  1362. public function lInsert($key, $position, $pivot, $value)
  1363. {
  1364. }
  1365. /**
  1366. * Adds a values to the set value stored at key.
  1367. *
  1368. * @param string $key Required key
  1369. * @param string|mixed ...$value1 Variadic list of values
  1370. *
  1371. * @return int|bool The number of elements added to the set.
  1372. * If this value is already in the set, FALSE is returned
  1373. *
  1374. * @link https://redis.io/commands/sadd
  1375. * @example
  1376. * <pre>
  1377. * $redis->sAdd('k', 'v1'); // int(1)
  1378. * $redis->sAdd('k', 'v1', 'v2', 'v3'); // int(2)
  1379. * </pre>
  1380. */
  1381. public function sAdd($key, ...$value1)
  1382. {
  1383. }
  1384. /**
  1385. * Removes the specified members from the set value stored at key.
  1386. *
  1387. * @param string $key
  1388. * @param string|mixed ...$member1 Variadic list of members
  1389. *
  1390. * @return int The number of elements removed from the set
  1391. *
  1392. * @link https://redis.io/commands/srem
  1393. * @example
  1394. * <pre>
  1395. * var_dump( $redis->sAdd('k', 'v1', 'v2', 'v3') ); // int(3)
  1396. * var_dump( $redis->sRem('k', 'v2', 'v3') ); // int(2)
  1397. * var_dump( $redis->sMembers('k') );
  1398. * //// Output:
  1399. * // array(1) {
  1400. * // [0]=> string(2) "v1"
  1401. * // }
  1402. * </pre>
  1403. */
  1404. public function sRem($key, ...$member1)
  1405. {
  1406. }
  1407. /**
  1408. * @see sRem()
  1409. * @link https://redis.io/commands/srem
  1410. * @deprecated use Redis::sRem()
  1411. *
  1412. * @param string $key
  1413. * @param string|mixed ...$member1
  1414. */
  1415. public function sRemove($key, ...$member1)
  1416. {
  1417. }
  1418. /**
  1419. * Moves the specified member from the set at srcKey to the set at dstKey.
  1420. *
  1421. * @param string $srcKey
  1422. * @param string $dstKey
  1423. * @param string|mixed $member
  1424. *
  1425. * @return bool If the operation is successful, return TRUE.
  1426. * If the srcKey and/or dstKey didn't exist, and/or the member didn't exist in srcKey, FALSE is returned.
  1427. *
  1428. * @link https://redis.io/commands/smove
  1429. * @example
  1430. * <pre>
  1431. * $redis->sAdd('key1' , 'set11');
  1432. * $redis->sAdd('key1' , 'set12');
  1433. * $redis->sAdd('key1' , 'set13'); // 'key1' => {'set11', 'set12', 'set13'}
  1434. * $redis->sAdd('key2' , 'set21');
  1435. * $redis->sAdd('key2' , 'set22'); // 'key2' => {'set21', 'set22'}
  1436. * $redis->sMove('key1', 'key2', 'set13'); // 'key1' => {'set11', 'set12'}
  1437. * // 'key2' => {'set21', 'set22', 'set13'}
  1438. * </pre>
  1439. */
  1440. public function sMove($srcKey, $dstKey, $member)
  1441. {
  1442. }
  1443. /**
  1444. * Checks if value is a member of the set stored at the key key.
  1445. *
  1446. * @param string $key
  1447. * @param string|mixed $value
  1448. *
  1449. * @return bool TRUE if value is a member of the set at key key, FALSE otherwise
  1450. *
  1451. * @link https://redis.io/commands/sismember
  1452. * @example
  1453. * <pre>
  1454. * $redis->sAdd('key1' , 'set1');
  1455. * $redis->sAdd('key1' , 'set2');
  1456. * $redis->sAdd('key1' , 'set3'); // 'key1' => {'set1', 'set2', 'set3'}
  1457. *
  1458. * $redis->sIsMember('key1', 'set1'); // TRUE
  1459. * $redis->sIsMember('key1', 'setX'); // FALSE
  1460. * </pre>
  1461. */
  1462. public function sIsMember($key, $value)
  1463. {
  1464. }
  1465. /**
  1466. * @see sIsMember()
  1467. * @link https://redis.io/commands/sismember
  1468. * @deprecated use Redis::sIsMember()
  1469. *
  1470. * @param string $key
  1471. * @param string|mixed $value
  1472. */
  1473. public function sContains($key, $value)
  1474. {
  1475. }
  1476. /**
  1477. * Returns the cardinality of the set identified by key.
  1478. *
  1479. * @param string $key
  1480. *
  1481. * @return int the cardinality of the set identified by key, 0 if the set doesn't exist.
  1482. *
  1483. * @link https://redis.io/commands/scard
  1484. * @example
  1485. * <pre>
  1486. * $redis->sAdd('key1' , 'set1');
  1487. * $redis->sAdd('key1' , 'set2');
  1488. * $redis->sAdd('key1' , 'set3'); // 'key1' => {'set1', 'set2', 'set3'}
  1489. * $redis->sCard('key1'); // 3
  1490. * $redis->sCard('keyX'); // 0
  1491. * </pre>
  1492. */
  1493. public function sCard($key)
  1494. {
  1495. }
  1496. /**
  1497. * Removes and returns a random element from the set value at Key.
  1498. *
  1499. * @param string $key
  1500. * @param int $count [optional]
  1501. *
  1502. * @return string|mixed|array|bool "popped" values
  1503. * bool FALSE if set identified by key is empty or doesn't exist.
  1504. *
  1505. * @link https://redis.io/commands/spop
  1506. * @example
  1507. * <pre>
  1508. * $redis->sAdd('key1' , 'set1');
  1509. * $redis->sAdd('key1' , 'set2');
  1510. * $redis->sAdd('key1' , 'set3'); // 'key1' => {'set3', 'set1', 'set2'}
  1511. * $redis->sPop('key1'); // 'set1', 'key1' => {'set3', 'set2'}
  1512. * $redis->sPop('key1'); // 'set3', 'key1' => {'set2'}
  1513. *
  1514. * // With count
  1515. * $redis->sAdd('key2', 'set1', 'set2', 'set3');
  1516. * var_dump( $redis->sPop('key2', 3) ); // Will return all members but in no particular order
  1517. *
  1518. * // array(3) {
  1519. * // [0]=> string(4) "set2"
  1520. * // [1]=> string(4) "set3"
  1521. * // [2]=> string(4) "set1"
  1522. * // }
  1523. * </pre>
  1524. */
  1525. public function sPop($key, $count = 1)
  1526. {
  1527. }
  1528. /**
  1529. * Returns a random element(s) from the set value at Key, without removing it.
  1530. *
  1531. * @param string $key
  1532. * @param int $count [optional]
  1533. *
  1534. * @return string|mixed|array|bool value(s) from the set
  1535. * bool FALSE if set identified by key is empty or doesn't exist and count argument isn't passed.
  1536. *
  1537. * @link https://redis.io/commands/srandmember
  1538. * @example
  1539. * <pre>
  1540. * $redis->sAdd('key1' , 'one');
  1541. * $redis->sAdd('key1' , 'two');
  1542. * $redis->sAdd('key1' , 'three'); // 'key1' => {'one', 'two', 'three'}
  1543. *
  1544. * var_dump( $redis->sRandMember('key1') ); // 'key1' => {'one', 'two', 'three'}
  1545. *
  1546. * // string(5) "three"
  1547. *
  1548. * var_dump( $redis->sRandMember('key1', 2) ); // 'key1' => {'one', 'two', 'three'}
  1549. *
  1550. * // array(2) {
  1551. * // [0]=> string(2) "one"
  1552. * // [1]=> string(5) "three"
  1553. * // }
  1554. * </pre>
  1555. */
  1556. public function sRandMember($key, $count = 1)
  1557. {
  1558. }
  1559. /**
  1560. * Returns the members of a set resulting from the intersection of all the sets
  1561. * held at the specified keys. If just a single key is specified, then this command
  1562. * produces the members of this set. If one of the keys is missing, FALSE is returned.
  1563. *
  1564. * @param string $key1 keys identifying the different sets on which we will apply the intersection.
  1565. * @param string ...$otherKeys variadic list of keys
  1566. *
  1567. * @return array contain the result of the intersection between those keys
  1568. * If the intersection between the different sets is empty, the return value will be empty array.
  1569. *
  1570. * @link https://redis.io/commands/sinter
  1571. * @example
  1572. * <pre>
  1573. * $redis->sAdd('key1', 'val1');
  1574. * $redis->sAdd('key1', 'val2');
  1575. * $redis->sAdd('key1', 'val3');
  1576. * $redis->sAdd('key1', 'val4');
  1577. *
  1578. * $redis->sAdd('key2', 'val3');
  1579. * $redis->sAdd('key2', 'val4');
  1580. *
  1581. * $redis->sAdd('key3', 'val3');
  1582. * $redis->sAdd('key3', 'val4');
  1583. *
  1584. * var_dump($redis->sInter('key1', 'key2', 'key3'));
  1585. *
  1586. * //array(2) {
  1587. * // [0]=>
  1588. * // string(4) "val4"
  1589. * // [1]=>
  1590. * // string(4) "val3"
  1591. * //}
  1592. * </pre>
  1593. */
  1594. public function sInter($key1, ...$otherKeys)
  1595. {
  1596. }
  1597. /**
  1598. * Performs a sInter command and stores the result in a new set.
  1599. *
  1600. * @param string $dstKey the key to store the diff into.
  1601. * @param string $key1 keys identifying the different sets on which we will apply the intersection.
  1602. * @param string ...$otherKeys variadic list of keys
  1603. *
  1604. * @return int|bool The cardinality of the resulting set, or FALSE in case of a missing key
  1605. *
  1606. * @link https://redis.io/commands/sinterstore
  1607. * @example
  1608. * <pre>
  1609. * $redis->sAdd('key1', 'val1');
  1610. * $redis->sAdd('key1', 'val2');
  1611. * $redis->sAdd('key1', 'val3');
  1612. * $redis->sAdd('key1', 'val4');
  1613. *
  1614. * $redis->sAdd('key2', 'val3');
  1615. * $redis->sAdd('key2', 'val4');
  1616. *
  1617. * $redis->sAdd('key3', 'val3');
  1618. * $redis->sAdd('key3', 'val4');
  1619. *
  1620. * var_dump($redis->sInterStore('output', 'key1', 'key2', 'key3'));
  1621. * var_dump($redis->sMembers('output'));
  1622. *
  1623. * //int(2)
  1624. * //
  1625. * //array(2) {
  1626. * // [0]=>
  1627. * // string(4) "val4"
  1628. * // [1]=>
  1629. * // string(4) "val3"
  1630. * //}
  1631. * </pre>
  1632. */
  1633. public function sInterStore($dstKey, $key1, ...$otherKeys)
  1634. {
  1635. }
  1636. /**
  1637. * Performs the union between N sets and returns it.
  1638. *
  1639. * @param string $key1 first key for union
  1640. * @param string ...$otherKeys variadic list of keys corresponding to sets in redis
  1641. *
  1642. * @return array string[] The union of all these sets
  1643. *
  1644. * @link https://redis.io/commands/sunionstore
  1645. * @example
  1646. * <pre>
  1647. * $redis->sAdd('s0', '1');
  1648. * $redis->sAdd('s0', '2');
  1649. * $redis->sAdd('s1', '3');
  1650. * $redis->sAdd('s1', '1');
  1651. * $redis->sAdd('s2', '3');
  1652. * $redis->sAdd('s2', '4');
  1653. *
  1654. * var_dump($redis->sUnion('s0', 's1', 's2'));
  1655. *
  1656. * array(4) {
  1657. * // [0]=>
  1658. * // string(1) "3"
  1659. * // [1]=>
  1660. * // string(1) "4"
  1661. * // [2]=>
  1662. * // string(1) "1"
  1663. * // [3]=>
  1664. * // string(1) "2"
  1665. * //}
  1666. * </pre>
  1667. */
  1668. public function sUnion($key1, ...$otherKeys)
  1669. {
  1670. }
  1671. /**
  1672. * Performs the same action as sUnion, but stores the result in the first key
  1673. *
  1674. * @param string $dstKey the key to store the diff into.
  1675. * @param string $key1 first key for union
  1676. * @param string ...$otherKeys variadic list of keys corresponding to sets in redis
  1677. *
  1678. * @return int Any number of keys corresponding to sets in redis
  1679. *
  1680. * @link https://redis.io/commands/sunionstore
  1681. * @example
  1682. * <pre>
  1683. * $redis->del('s0', 's1', 's2');
  1684. *
  1685. * $redis->sAdd('s0', '1');
  1686. * $redis->sAdd('s0', '2');
  1687. * $redis->sAdd('s1', '3');
  1688. * $redis->sAdd('s1', '1');
  1689. * $redis->sAdd('s2', '3');
  1690. * $redis->sAdd('s2', '4');
  1691. *
  1692. * var_dump($redis->sUnionStore('dst', 's0', 's1', 's2'));
  1693. * var_dump($redis->sMembers('dst'));
  1694. *
  1695. * //int(4)
  1696. * //array(4) {
  1697. * // [0]=>
  1698. * // string(1) "3"
  1699. * // [1]=>
  1700. * // string(1) "4"
  1701. * // [2]=>
  1702. * // string(1) "1"
  1703. * // [3]=>
  1704. * // string(1) "2"
  1705. * //}
  1706. * </pre>
  1707. */
  1708. public function sUnionStore($dstKey, $key1, ...$otherKeys)
  1709. {
  1710. }
  1711. /**
  1712. * Performs the difference between N sets and returns it.
  1713. *
  1714. * @param string $key1 first key for diff
  1715. * @param string ...$otherKeys variadic list of keys corresponding to sets in redis
  1716. *
  1717. * @return array string[] The difference of the first set will all the others
  1718. *
  1719. * @link https://redis.io/commands/sdiff
  1720. * @example
  1721. * <pre>
  1722. * $redis->del('s0', 's1', 's2');
  1723. *
  1724. * $redis->sAdd('s0', '1');
  1725. * $redis->sAdd('s0', '2');
  1726. * $redis->sAdd('s0', '3');
  1727. * $redis->sAdd('s0', '4');
  1728. *
  1729. * $redis->sAdd('s1', '1');
  1730. * $redis->sAdd('s2', '3');
  1731. *
  1732. * var_dump($redis->sDiff('s0', 's1', 's2'));
  1733. *
  1734. * //array(2) {
  1735. * // [0]=>
  1736. * // string(1) "4"
  1737. * // [1]=>
  1738. * // string(1) "2"
  1739. * //}
  1740. * </pre>
  1741. */
  1742. public function sDiff($key1, ...$otherKeys)
  1743. {
  1744. }
  1745. /**
  1746. * Performs the same action as sDiff, but stores the result in the first key
  1747. *
  1748. * @param string $dstKey the key to store the diff into.
  1749. * @param string $key1 first key for diff
  1750. * @param string ...$otherKeys variadic list of keys corresponding to sets in redis
  1751. *
  1752. * @return int|bool The cardinality of the resulting set, or FALSE in case of a missing key
  1753. *
  1754. * @link https://redis.io/commands/sdiffstore
  1755. * @example
  1756. * <pre>
  1757. * $redis->del('s0', 's1', 's2');
  1758. *
  1759. * $redis->sAdd('s0', '1');
  1760. * $redis->sAdd('s0', '2');
  1761. * $redis->sAdd('s0', '3');
  1762. * $redis->sAdd('s0', '4');
  1763. *
  1764. * $redis->sAdd('s1', '1');
  1765. * $redis->sAdd('s2', '3');
  1766. *
  1767. * var_dump($redis->sDiffStore('dst', 's0', 's1', 's2'));
  1768. * var_dump($redis->sMembers('dst'));
  1769. *
  1770. * //int(2)
  1771. * //array(2) {
  1772. * // [0]=>
  1773. * // string(1) "4"
  1774. * // [1]=>
  1775. * // string(1) "2"
  1776. * //}
  1777. * </pre>
  1778. */
  1779. public function sDiffStore($dstKey, $key1, ...$otherKeys)
  1780. {
  1781. }
  1782. /**
  1783. * Returns the contents of a set.
  1784. *
  1785. * @param string $key
  1786. *
  1787. * @return array An array of elements, the contents of the set
  1788. *
  1789. * @link https://redis.io/commands/smembers
  1790. * @example
  1791. * <pre>
  1792. * $redis->del('s');
  1793. * $redis->sAdd('s', 'a');
  1794. * $redis->sAdd('s', 'b');
  1795. * $redis->sAdd('s', 'a');
  1796. * $redis->sAdd('s', 'c');
  1797. * var_dump($redis->sMembers('s'));
  1798. *
  1799. * //array(3) {
  1800. * // [0]=>
  1801. * // string(1) "c"
  1802. * // [1]=>
  1803. * // string(1) "a"
  1804. * // [2]=>
  1805. * // string(1) "b"
  1806. * //}
  1807. * // The order is random and corresponds to redis' own internal representation of the set structure.
  1808. * </pre>
  1809. */
  1810. public function sMembers($key)
  1811. {
  1812. }
  1813. /**
  1814. * @see sMembers()
  1815. * @link https://redis.io/commands/smembers
  1816. * @deprecated use Redis::sMembers()
  1817. *
  1818. * @param string $key
  1819. * @return array An array of elements, the contents of the set
  1820. */
  1821. public function sGetMembers($key)
  1822. {
  1823. }
  1824. /**
  1825. * Scan a set for members
  1826. *
  1827. * @param string $key The set to search.
  1828. * @param int $iterator LONG (reference) to the iterator as we go.
  1829. * @param string $pattern String, optional pattern to match against.
  1830. * @param int $count How many members to return at a time (Redis might return a different amount)
  1831. *
  1832. * @return array|bool PHPRedis will return an array of keys or FALSE when we're done iterating
  1833. *
  1834. * @link https://redis.io/commands/sscan
  1835. * @example
  1836. * <pre>
  1837. * $iterator = null;
  1838. * while ($members = $redis->sScan('set', $iterator)) {
  1839. * foreach ($members as $member) {
  1840. * echo $member . PHP_EOL;
  1841. * }
  1842. * }
  1843. * </pre>
  1844. */
  1845. public function sScan($key, &$iterator, $pattern = null, $count = 0)
  1846. {
  1847. }
  1848. /**
  1849. * Sets a value and returns the previous entry at that key.
  1850. *
  1851. * @param string $key
  1852. * @param string|mixed $value
  1853. *
  1854. * @return string|mixed A string (mixed, if used serializer), the previous value located at this key
  1855. *
  1856. * @link https://redis.io/commands/getset
  1857. * @example
  1858. * <pre>
  1859. * $redis->set('x', '42');
  1860. * $exValue = $redis->getSet('x', 'lol'); // return '42', replaces x by 'lol'
  1861. * $newValue = $redis->get('x')' // return 'lol'
  1862. * </pre>
  1863. */
  1864. public function getSet($key, $value)
  1865. {
  1866. }
  1867. /**
  1868. * Returns a random key
  1869. *
  1870. * @return string an existing key in redis
  1871. *
  1872. * @link https://redis.io/commands/randomkey
  1873. * @example
  1874. * <pre>
  1875. * $key = $redis->randomKey();
  1876. * $surprise = $redis->get($key); // who knows what's in there.
  1877. * </pre>
  1878. */
  1879. public function randomKey()
  1880. {
  1881. }
  1882. /**
  1883. * Switches to a given database
  1884. *
  1885. * @param int $dbIndex
  1886. *
  1887. * @return bool TRUE in case of success, FALSE in case of failure
  1888. *
  1889. * @link https://redis.io/commands/select
  1890. * @example
  1891. * <pre>
  1892. * $redis->select(0); // switch to DB 0
  1893. * $redis->set('x', '42'); // write 42 to x
  1894. * $redis->move('x', 1); // move to DB 1
  1895. * $redis->select(1); // switch to DB 1
  1896. * $redis->get('x'); // will return 42
  1897. * </pre>
  1898. */
  1899. public function select($dbIndex)
  1900. {
  1901. }
  1902. /**
  1903. * Moves a key to a different database.
  1904. *
  1905. * @param string $key
  1906. * @param int $dbIndex
  1907. *
  1908. * @return bool TRUE in case of success, FALSE in case of failure
  1909. *
  1910. * @link https://redis.io/commands/move
  1911. * @example
  1912. * <pre>
  1913. * $redis->select(0); // switch to DB 0
  1914. * $redis->set('x', '42'); // write 42 to x
  1915. * $redis->move('x', 1); // move to DB 1
  1916. * $redis->select(1); // switch to DB 1
  1917. * $redis->get('x'); // will return 42
  1918. * </pre>
  1919. */
  1920. public function move($key, $dbIndex)
  1921. {
  1922. }
  1923. /**
  1924. * Renames a key
  1925. *
  1926. * @param string $srcKey
  1927. * @param string $dstKey
  1928. *
  1929. * @return bool TRUE in case of success, FALSE in case of failure
  1930. *
  1931. * @link https://redis.io/commands/rename
  1932. * @example
  1933. * <pre>
  1934. * $redis->set('x', '42');
  1935. * $redis->rename('x', 'y');
  1936. * $redis->get('y'); // → 42
  1937. * $redis->get('x'); // → `FALSE`
  1938. * </pre>
  1939. */
  1940. public function rename($srcKey, $dstKey)
  1941. {
  1942. }
  1943. /**
  1944. * @see rename()
  1945. * @link https://redis.io/commands/rename
  1946. * @deprecated use Redis::rename()
  1947. *
  1948. * @param string $srcKey
  1949. * @param string $dstKey
  1950. */
  1951. public function renameKey($srcKey, $dstKey)
  1952. {
  1953. }
  1954. /**
  1955. * Renames a key
  1956. *
  1957. * Same as rename, but will not replace a key if the destination already exists.
  1958. * This is the same behaviour as setNx.
  1959. *
  1960. * @param string $srcKey
  1961. * @param string $dstKey
  1962. *
  1963. * @return bool TRUE in case of success, FALSE in case of failure
  1964. *
  1965. * @link https://redis.io/commands/renamenx
  1966. * @example
  1967. * <pre>
  1968. * $redis->set('x', '42');
  1969. * $redis->rename('x', 'y');
  1970. * $redis->get('y'); // → 42
  1971. * $redis->get('x'); // → `FALSE`
  1972. * </pre>
  1973. */
  1974. public function renameNx($srcKey, $dstKey)
  1975. {
  1976. }
  1977. /**
  1978. * Sets an expiration date (a timeout) on an item
  1979. *
  1980. * @param string $key The key that will disappear
  1981. * @param int $ttl The key's remaining Time To Live, in seconds
  1982. *
  1983. * @return bool TRUE in case of success, FALSE in case of failure
  1984. *
  1985. * @link https://redis.io/commands/expire
  1986. * @example
  1987. * <pre>
  1988. * $redis->set('x', '42');
  1989. * $redis->expire('x', 3); // x will disappear in 3 seconds.
  1990. * sleep(5); // wait 5 seconds
  1991. * $redis->get('x'); // will return `FALSE`, as 'x' has expired.
  1992. * </pre>
  1993. */
  1994. public function expire($key, $ttl)
  1995. {
  1996. }
  1997. /**
  1998. * Sets an expiration date (a timeout in milliseconds) on an item
  1999. *
  2000. * @param string $key The key that will disappear.
  2001. * @param int $ttl The key's remaining Time To Live, in milliseconds
  2002. *
  2003. * @return bool TRUE in case of success, FALSE in case of failure
  2004. *
  2005. * @link https://redis.io/commands/pexpire
  2006. * @example
  2007. * <pre>
  2008. * $redis->set('x', '42');
  2009. * $redis->pExpire('x', 11500); // x will disappear in 11500 milliseconds.
  2010. * $redis->ttl('x'); // 12
  2011. * $redis->pttl('x'); // 11500
  2012. * </pre>
  2013. */
  2014. public function pExpire($key, $ttl)
  2015. {
  2016. }
  2017. /**
  2018. * @see expire()
  2019. * @link https://redis.io/commands/expire
  2020. * @deprecated use Redis::expire()
  2021. *
  2022. * @param string $key
  2023. * @param int $ttl
  2024. * @return bool
  2025. */
  2026. public function setTimeout($key, $ttl)
  2027. {
  2028. }
  2029. /**
  2030. * Sets an expiration date (a timestamp) on an item.
  2031. *
  2032. * @param string $key The key that will disappear.
  2033. * @param int $timestamp Unix timestamp. The key's date of death, in seconds from Epoch time.
  2034. *
  2035. * @return bool TRUE in case of success, FALSE in case of failure
  2036. *
  2037. * @link https://redis.io/commands/expireat
  2038. * @example
  2039. * <pre>
  2040. * $redis->set('x', '42');
  2041. * $now = time(NULL); // current timestamp
  2042. * $redis->expireAt('x', $now + 3); // x will disappear in 3 seconds.
  2043. * sleep(5); // wait 5 seconds
  2044. * $redis->get('x'); // will return `FALSE`, as 'x' has expired.
  2045. * </pre>
  2046. */
  2047. public function expireAt($key, $timestamp)
  2048. {
  2049. }
  2050. /**
  2051. * Sets an expiration date (a timestamp) on an item. Requires a timestamp in milliseconds
  2052. *
  2053. * @param string $key The key that will disappear
  2054. * @param int $timestamp Unix timestamp. The key's date of death, in seconds from Epoch time
  2055. *
  2056. * @return bool TRUE in case of success, FALSE in case of failure
  2057. *
  2058. * @link https://redis.io/commands/pexpireat
  2059. * @example
  2060. * <pre>
  2061. * $redis->set('x', '42');
  2062. * $redis->pExpireAt('x', 1555555555005);
  2063. * echo $redis->ttl('x'); // 218270121
  2064. * echo $redis->pttl('x'); // 218270120575
  2065. * </pre>
  2066. */
  2067. public function pExpireAt($key, $timestamp)
  2068. {
  2069. }
  2070. /**
  2071. * Returns the keys that match a certain pattern.
  2072. *
  2073. * @param string $pattern pattern, using '*' as a wildcard
  2074. *
  2075. * @return array string[] The keys that match a certain pattern.
  2076. *
  2077. * @link https://redis.io/commands/keys
  2078. * @example
  2079. * <pre>
  2080. * $allKeys = $redis->keys('*'); // all keys will match this.
  2081. * $keyWithUserPrefix = $redis->keys('user*');
  2082. * </pre>
  2083. */
  2084. public function keys($pattern)
  2085. {
  2086. }
  2087. /**
  2088. * @see keys()
  2089. * @deprecated use Redis::keys()
  2090. *
  2091. * @param string $pattern
  2092. * @link https://redis.io/commands/keys
  2093. */
  2094. public function getKeys($pattern)
  2095. {
  2096. }
  2097. /**
  2098. * Returns the current database's size
  2099. *
  2100. * @return int DB size, in number of keys
  2101. *
  2102. * @link https://redis.io/commands/dbsize
  2103. * @example
  2104. * <pre>
  2105. * $count = $redis->dbSize();
  2106. * echo "Redis has $count keys\n";
  2107. * </pre>
  2108. */
  2109. public function dbSize()
  2110. {
  2111. }
  2112. /**
  2113. * Authenticate the connection using a password.
  2114. * Warning: The password is sent in plain-text over the network.
  2115. *
  2116. * @param string $password
  2117. *
  2118. * @return bool TRUE if the connection is authenticated, FALSE otherwise
  2119. *
  2120. * @link https://redis.io/commands/auth
  2121. * @example $redis->auth('foobared');
  2122. */
  2123. public function auth($password)
  2124. {
  2125. }
  2126. /**
  2127. * Starts the background rewrite of AOF (Append-Only File)
  2128. *
  2129. * @return bool TRUE in case of success, FALSE in case of failure
  2130. *
  2131. * @link https://redis.io/commands/bgrewriteaof
  2132. * @example $redis->bgrewriteaof();
  2133. */
  2134. public function bgrewriteaof()
  2135. {
  2136. }
  2137. /**
  2138. * Changes the slave status
  2139. * Either host and port, or no parameter to stop being a slave.
  2140. *
  2141. * @param string $host [optional]
  2142. * @param int $port [optional]
  2143. *
  2144. * @return bool TRUE in case of success, FALSE in case of failure
  2145. *
  2146. * @link https://redis.io/commands/slaveof
  2147. * @example
  2148. * <pre>
  2149. * $redis->slaveof('10.0.1.7', 6379);
  2150. * // ...
  2151. * $redis->slaveof();
  2152. * </pre>
  2153. */
  2154. public function slaveof($host = '127.0.0.1', $port = 6379)
  2155. {
  2156. }
  2157. /**
  2158. * Access the Redis slowLog
  2159. *
  2160. * @param string $operation This can be either GET, LEN, or RESET
  2161. * @param int|null $length If executing a SLOWLOG GET command, you can pass an optional length.
  2162. *
  2163. * @return mixed The return value of SLOWLOG will depend on which operation was performed.
  2164. * - SLOWLOG GET: Array of slowLog entries, as provided by Redis
  2165. * - SLOGLOG LEN: Integer, the length of the slowLog
  2166. * - SLOWLOG RESET: Boolean, depending on success
  2167. *
  2168. * @example
  2169. * <pre>
  2170. * // Get ten slowLog entries
  2171. * $redis->slowLog('get', 10);
  2172. * // Get the default number of slowLog entries
  2173. *
  2174. * $redis->slowLog('get');
  2175. * // Reset our slowLog
  2176. * $redis->slowLog('reset');
  2177. *
  2178. * // Retrieve slowLog length
  2179. * $redis->slowLog('len');
  2180. * </pre>
  2181. *
  2182. * @link https://redis.io/commands/slowlog
  2183. */
  2184. public function slowLog(string $operation, int $length = null)
  2185. {
  2186. }
  2187. /**
  2188. * Describes the object pointed to by a key.
  2189. * The information to retrieve (string) and the key (string).
  2190. * Info can be one of the following:
  2191. * - "encoding"
  2192. * - "refcount"
  2193. * - "idletime"
  2194. *
  2195. * @param string $string
  2196. * @param string $key
  2197. *
  2198. * @return string|int|bool for "encoding", int for "refcount" and "idletime", FALSE if the key doesn't exist.
  2199. *
  2200. * @link https://redis.io/commands/object
  2201. * @example
  2202. * <pre>
  2203. * $redis->lPush('l', 'Hello, world!');
  2204. * $redis->object("encoding", "l"); // → ziplist
  2205. * $redis->object("refcount", "l"); // → 1
  2206. * $redis->object("idletime", "l"); // → 400 (in seconds, with a precision of 10 seconds).
  2207. * </pre>
  2208. */
  2209. public function object($string = '', $key = '')
  2210. {
  2211. }
  2212. /**
  2213. * Performs a synchronous save.
  2214. *
  2215. * @return bool TRUE in case of success, FALSE in case of failure
  2216. * If a save is already running, this command will fail and return FALSE.
  2217. *
  2218. * @link https://redis.io/commands/save
  2219. * @example $redis->save();
  2220. */
  2221. public function save()
  2222. {
  2223. }
  2224. /**
  2225. * Performs a background save.
  2226. *
  2227. * @return bool TRUE in case of success, FALSE in case of failure
  2228. * If a save is already running, this command will fail and return FALSE
  2229. *
  2230. * @link https://redis.io/commands/bgsave
  2231. * @example $redis->bgSave();
  2232. */
  2233. public function bgsave()
  2234. {
  2235. }
  2236. /**
  2237. * Returns the timestamp of the last disk save.
  2238. *
  2239. * @return int timestamp
  2240. *
  2241. * @link https://redis.io/commands/lastsave
  2242. * @example $redis->lastSave();
  2243. */
  2244. public function lastSave()
  2245. {
  2246. }
  2247. /**
  2248. * Blocks the current client until all the previous write commands are successfully transferred and
  2249. * acknowledged by at least the specified number of slaves.
  2250. *
  2251. * @param int $numSlaves Number of slaves that need to acknowledge previous write commands.
  2252. * @param int $timeout Timeout in milliseconds.
  2253. *
  2254. * @return int The command returns the number of slaves reached by all the writes performed in the
  2255. * context of the current connection
  2256. *
  2257. * @link https://redis.io/commands/wait
  2258. * @example $redis->wait(2, 1000);
  2259. */
  2260. public function wait($numSlaves, $timeout)
  2261. {
  2262. }
  2263. /**
  2264. * Returns the type of data pointed by a given key.
  2265. *
  2266. * @param string $key
  2267. *
  2268. * @return int
  2269. * Depending on the type of the data pointed by the key,
  2270. * this method will return the following value:
  2271. * - string: Redis::REDIS_STRING
  2272. * - set: Redis::REDIS_SET
  2273. * - list: Redis::REDIS_LIST
  2274. * - zset: Redis::REDIS_ZSET
  2275. * - hash: Redis::REDIS_HASH
  2276. * - other: Redis::REDIS_NOT_FOUND
  2277. *
  2278. * @link https://redis.io/commands/type
  2279. * @example $redis->type('key');
  2280. */
  2281. public function type($key)
  2282. {
  2283. }
  2284. /**
  2285. * Append specified string to the string stored in specified key.
  2286. *
  2287. * @param string $key
  2288. * @param string|mixed $value
  2289. *
  2290. * @return int Size of the value after the append
  2291. *
  2292. * @link https://redis.io/commands/append
  2293. * @example
  2294. * <pre>
  2295. * $redis->set('key', 'value1');
  2296. * $redis->append('key', 'value2'); // 12
  2297. * $redis->get('key'); // 'value1value2'
  2298. * </pre>
  2299. */
  2300. public function append($key, $value)
  2301. {
  2302. }
  2303. /**
  2304. * Return a substring of a larger string
  2305. *
  2306. * @param string $key
  2307. * @param int $start
  2308. * @param int $end
  2309. *
  2310. * @return string the substring
  2311. *
  2312. * @link https://redis.io/commands/getrange
  2313. * @example
  2314. * <pre>
  2315. * $redis->set('key', 'string value');
  2316. * $redis->getRange('key', 0, 5); // 'string'
  2317. * $redis->getRange('key', -5, -1); // 'value'
  2318. * </pre>
  2319. */
  2320. public function getRange($key, $start, $end)
  2321. {
  2322. }
  2323. /**
  2324. * Return a substring of a larger string
  2325. *
  2326. * @deprecated
  2327. * @param string $key
  2328. * @param int $start
  2329. * @param int $end
  2330. */
  2331. public function substr($key, $start, $end)
  2332. {
  2333. }
  2334. /**
  2335. * Changes a substring of a larger string.
  2336. *
  2337. * @param string $key
  2338. * @param int $offset
  2339. * @param string $value
  2340. *
  2341. * @return int the length of the string after it was modified
  2342. *
  2343. * @link https://redis.io/commands/setrange
  2344. * @example
  2345. * <pre>
  2346. * $redis->set('key', 'Hello world');
  2347. * $redis->setRange('key', 6, "redis"); // returns 11
  2348. * $redis->get('key'); // "Hello redis"
  2349. * </pre>
  2350. */
  2351. public function setRange($key, $offset, $value)
  2352. {
  2353. }
  2354. /**
  2355. * Get the length of a string value.
  2356. *
  2357. * @param string $key
  2358. * @return int
  2359. *
  2360. * @link https://redis.io/commands/strlen
  2361. * @example
  2362. * <pre>
  2363. * $redis->set('key', 'value');
  2364. * $redis->strlen('key'); // 5
  2365. * </pre>
  2366. */
  2367. public function strlen($key)
  2368. {
  2369. }
  2370. /**
  2371. * Return the position of the first bit set to 1 or 0 in a string. The position is returned, thinking of the
  2372. * string as an array of bits from left to right, where the first byte's most significant bit is at position 0,
  2373. * the second byte's most significant bit is at position 8, and so forth.
  2374. *
  2375. * @param string $key
  2376. * @param int $bit
  2377. * @param int $start
  2378. * @param int $end
  2379. *
  2380. * @return int The command returns the position of the first bit set to 1 or 0 according to the request.
  2381. * If we look for set bits (the bit argument is 1) and the string is empty or composed of just
  2382. * zero bytes, -1 is returned. If we look for clear bits (the bit argument is 0) and the string
  2383. * only contains bit set to 1, the function returns the first bit not part of the string on the
  2384. * right. So if the string is three bytes set to the value 0xff the command BITPOS key 0 will
  2385. * return 24, since up to bit 23 all the bits are 1. Basically, the function considers the right
  2386. * of the string as padded with zeros if you look for clear bits and specify no range or the
  2387. * start argument only. However, this behavior changes if you are looking for clear bits and
  2388. * specify a range with both start and end. If no clear bit is found in the specified range, the
  2389. * function returns -1 as the user specified a clear range and there are no 0 bits in that range.
  2390. *
  2391. * @link https://redis.io/commands/bitpos
  2392. * @example
  2393. * <pre>
  2394. * $redis->set('key', '\xff\xff');
  2395. * $redis->bitpos('key', 1); // int(0)
  2396. * $redis->bitpos('key', 1, 1); // int(8)
  2397. * $redis->bitpos('key', 1, 3); // int(-1)
  2398. * $redis->bitpos('key', 0); // int(16)
  2399. * $redis->bitpos('key', 0, 1); // int(16)
  2400. * $redis->bitpos('key', 0, 1, 5); // int(-1)
  2401. * </pre>
  2402. */
  2403. public function bitpos($key, $bit, $start = 0, $end = null)
  2404. {
  2405. }
  2406. /**
  2407. * Return a single bit out of a larger string
  2408. *
  2409. * @param string $key
  2410. * @param int $offset
  2411. *
  2412. * @return int the bit value (0 or 1)
  2413. *
  2414. * @link https://redis.io/commands/getbit
  2415. * @example
  2416. * <pre>
  2417. * $redis->set('key', "\x7f"); // this is 0111 1111
  2418. * $redis->getBit('key', 0); // 0
  2419. * $redis->getBit('key', 1); // 1
  2420. * </pre>
  2421. */
  2422. public function getBit($key, $offset)
  2423. {
  2424. }
  2425. /**
  2426. * Changes a single bit of a string.
  2427. *
  2428. * @param string $key
  2429. * @param int $offset
  2430. * @param bool|int $value bool or int (1 or 0)
  2431. *
  2432. * @return int 0 or 1, the value of the bit before it was set
  2433. *
  2434. * @link https://redis.io/commands/setbit
  2435. * @example
  2436. * <pre>
  2437. * $redis->set('key', "*"); // ord("*") = 42 = 0x2f = "0010 1010"
  2438. * $redis->setBit('key', 5, 1); // returns 0
  2439. * $redis->setBit('key', 7, 1); // returns 0
  2440. * $redis->get('key'); // chr(0x2f) = "/" = b("0010 1111")
  2441. * </pre>
  2442. */
  2443. public function setBit($key, $offset, $value)
  2444. {
  2445. }
  2446. /**
  2447. * Count bits in a string
  2448. *
  2449. * @param string $key
  2450. *
  2451. * @return int The number of bits set to 1 in the value behind the input key
  2452. *
  2453. * @link https://redis.io/commands/bitcount
  2454. * @example
  2455. * <pre>
  2456. * $redis->set('bit', '345'); // // 11 0011 0011 0100 0011 0101
  2457. * var_dump( $redis->bitCount('bit', 0, 0) ); // int(4)
  2458. * var_dump( $redis->bitCount('bit', 1, 1) ); // int(3)
  2459. * var_dump( $redis->bitCount('bit', 2, 2) ); // int(4)
  2460. * var_dump( $redis->bitCount('bit', 0, 2) ); // int(11)
  2461. * </pre>
  2462. */
  2463. public function bitCount($key)
  2464. {
  2465. }
  2466. /**
  2467. * Bitwise operation on multiple keys.
  2468. *
  2469. * @param string $operation either "AND", "OR", "NOT", "XOR"
  2470. * @param string $retKey return key
  2471. * @param string $key1 first key
  2472. * @param string ...$otherKeys variadic list of keys
  2473. *
  2474. * @return int The size of the string stored in the destination key
  2475. *
  2476. * @link https://redis.io/commands/bitop
  2477. * @example
  2478. * <pre>
  2479. * $redis->set('bit1', '1'); // 11 0001
  2480. * $redis->set('bit2', '2'); // 11 0010
  2481. *
  2482. * $redis->bitOp('AND', 'bit', 'bit1', 'bit2'); // bit = 110000
  2483. * $redis->bitOp('OR', 'bit', 'bit1', 'bit2'); // bit = 110011
  2484. * $redis->bitOp('NOT', 'bit', 'bit1', 'bit2'); // bit = 110011
  2485. * $redis->bitOp('XOR', 'bit', 'bit1', 'bit2'); // bit = 11
  2486. * </pre>
  2487. */
  2488. public function bitOp($operation, $retKey, $key1, ...$otherKeys)
  2489. {
  2490. }
  2491. /**
  2492. * Removes all entries from the current database.
  2493. *
  2494. * @return bool Always TRUE
  2495. * @link https://redis.io/commands/flushdb
  2496. * @example $redis->flushDB();
  2497. */
  2498. public function flushDB()
  2499. {
  2500. }
  2501. /**
  2502. * Removes all entries from all databases.
  2503. *
  2504. * @return bool Always TRUE
  2505. *
  2506. * @link https://redis.io/commands/flushall
  2507. * @example $redis->flushAll();
  2508. */
  2509. public function flushAll()
  2510. {
  2511. }
  2512. /**
  2513. * Sort
  2514. *
  2515. * @param string $key
  2516. * @param array $option array(key => value, ...) - optional, with the following keys and values:
  2517. * - 'by' => 'some_pattern_*',
  2518. * - 'limit' => array(0, 1),
  2519. * - 'get' => 'some_other_pattern_*' or an array of patterns,
  2520. * - 'sort' => 'asc' or 'desc',
  2521. * - 'alpha' => TRUE,
  2522. * - 'store' => 'external-key'
  2523. *
  2524. * @return array
  2525. * An array of values, or a number corresponding to the number of elements stored if that was used
  2526. *
  2527. * @link https://redis.io/commands/sort
  2528. * @example
  2529. * <pre>
  2530. * $redis->del('s');
  2531. * $redis->sadd('s', 5);
  2532. * $redis->sadd('s', 4);
  2533. * $redis->sadd('s', 2);
  2534. * $redis->sadd('s', 1);
  2535. * $redis->sadd('s', 3);
  2536. *
  2537. * var_dump($redis->sort('s')); // 1,2,3,4,5
  2538. * var_dump($redis->sort('s', array('sort' => 'desc'))); // 5,4,3,2,1
  2539. * var_dump($redis->sort('s', array('sort' => 'desc', 'store' => 'out'))); // (int)5
  2540. * </pre>
  2541. */
  2542. public function sort($key, $option = null)
  2543. {
  2544. }
  2545. /**
  2546. * Returns an associative array of strings and integers
  2547. *
  2548. * @param string $option Optional. The option to provide redis.
  2549. * SERVER | CLIENTS | MEMORY | PERSISTENCE | STATS | REPLICATION | CPU | CLASTER | KEYSPACE | COMANDSTATS
  2550. *
  2551. * Returns an associative array of strings and integers, with the following keys:
  2552. * - redis_version
  2553. * - redis_git_sha1
  2554. * - redis_git_dirty
  2555. * - arch_bits
  2556. * - multiplexing_api
  2557. * - process_id
  2558. * - uptime_in_seconds
  2559. * - uptime_in_days
  2560. * - lru_clock
  2561. * - used_cpu_sys
  2562. * - used_cpu_user
  2563. * - used_cpu_sys_children
  2564. * - used_cpu_user_children
  2565. * - connected_clients
  2566. * - connected_slaves
  2567. * - client_longest_output_list
  2568. * - client_biggest_input_buf
  2569. * - blocked_clients
  2570. * - used_memory
  2571. * - used_memory_human
  2572. * - used_memory_peak
  2573. * - used_memory_peak_human
  2574. * - mem_fragmentation_ratio
  2575. * - mem_allocator
  2576. * - loading
  2577. * - aof_enabled
  2578. * - changes_since_last_save
  2579. * - bgsave_in_progress
  2580. * - last_save_time
  2581. * - total_connections_received
  2582. * - total_commands_processed
  2583. * - expired_keys
  2584. * - evicted_keys
  2585. * - keyspace_hits
  2586. * - keyspace_misses
  2587. * - hash_max_zipmap_entries
  2588. * - hash_max_zipmap_value
  2589. * - pubsub_channels
  2590. * - pubsub_patterns
  2591. * - latest_fork_usec
  2592. * - vm_enabled
  2593. * - role
  2594. *
  2595. * @return string
  2596. *
  2597. * @link https://redis.io/commands/info
  2598. * @example
  2599. * <pre>
  2600. * $redis->info();
  2601. *
  2602. * or
  2603. *
  2604. * $redis->info("COMMANDSTATS"); //Information on the commands that have been run (>=2.6 only)
  2605. * $redis->info("CPU"); // just CPU information from Redis INFO
  2606. * </pre>
  2607. */
  2608. public function info($option = null)
  2609. {
  2610. }
  2611. /**
  2612. * Resets the statistics reported by Redis using the INFO command (`info()` function).
  2613. * These are the counters that are reset:
  2614. * - Keyspace hits
  2615. * - Keyspace misses
  2616. * - Number of commands processed
  2617. * - Number of connections received
  2618. * - Number of expired keys
  2619. *
  2620. * @return bool `TRUE` in case of success, `FALSE` in case of failure.
  2621. *
  2622. * @example $redis->resetStat();
  2623. * @link https://redis.io/commands/config-resetstat
  2624. */
  2625. public function resetStat()
  2626. {
  2627. }
  2628. /**
  2629. * Returns the time to live left for a given key, in seconds. If the key doesn't exist, FALSE is returned.
  2630. *
  2631. * @param string $key
  2632. *
  2633. * @return int|bool the time left to live in seconds
  2634. *
  2635. * @link https://redis.io/commands/ttl
  2636. * @example
  2637. * <pre>
  2638. * $redis->setex('key', 123, 'test');
  2639. * $redis->ttl('key'); // int(123)
  2640. * </pre>
  2641. */
  2642. public function ttl($key)
  2643. {
  2644. }
  2645. /**
  2646. * Returns a time to live left for a given key, in milliseconds.
  2647. *
  2648. * If the key doesn't exist, FALSE is returned.
  2649. *
  2650. * @param string $key
  2651. *
  2652. * @return int|bool the time left to live in milliseconds
  2653. *
  2654. * @link https://redis.io/commands/pttl
  2655. * @example
  2656. * <pre>
  2657. * $redis->setex('key', 123, 'test');
  2658. * $redis->pttl('key'); // int(122999)
  2659. * </pre>
  2660. */
  2661. public function pttl($key)
  2662. {
  2663. }
  2664. /**
  2665. * Remove the expiration timer from a key.
  2666. *
  2667. * @param string $key
  2668. *
  2669. * @return bool TRUE if a timeout was removed, FALSE if the key didn’t exist or didn’t have an expiration timer.
  2670. *
  2671. * @link https://redis.io/commands/persist
  2672. * @example $redis->persist('key');
  2673. */
  2674. public function persist($key)
  2675. {
  2676. }
  2677. /**
  2678. * Sets multiple key-value pairs in one atomic command.
  2679. * MSETNX only returns TRUE if all the keys were set (see SETNX).
  2680. *
  2681. * @param array $array Pairs: array(key => value, ...)
  2682. *
  2683. * @return bool TRUE in case of success, FALSE in case of failure
  2684. *
  2685. * @link https://redis.io/commands/mset
  2686. * @example
  2687. * <pre>
  2688. * $redis->mset(array('key0' => 'value0', 'key1' => 'value1'));
  2689. * var_dump($redis->get('key0'));
  2690. * var_dump($redis->get('key1'));
  2691. * // Output:
  2692. * // string(6) "value0"
  2693. * // string(6) "value1"
  2694. * </pre>
  2695. */
  2696. public function mset(array $array)
  2697. {
  2698. }
  2699. /**
  2700. * Get the values of all the specified keys.
  2701. * If one or more keys dont exist, the array will contain FALSE at the position of the key.
  2702. *
  2703. * @param array $keys Array containing the list of the keys
  2704. *
  2705. * @return array Array containing the values related to keys in argument
  2706. *
  2707. * @deprecated use Redis::mGet()
  2708. * @example
  2709. * <pre>
  2710. * $redis->set('key1', 'value1');
  2711. * $redis->set('key2', 'value2');
  2712. * $redis->set('key3', 'value3');
  2713. * $redis->getMultiple(array('key1', 'key2', 'key3')); // array('value1', 'value2', 'value3');
  2714. * $redis->getMultiple(array('key0', 'key1', 'key5')); // array(`FALSE`, 'value2', `FALSE`);
  2715. * </pre>
  2716. */
  2717. public function getMultiple(array $keys)
  2718. {
  2719. }
  2720. /**
  2721. * Returns the values of all specified keys.
  2722. *
  2723. * For every key that does not hold a string value or does not exist,
  2724. * the special value false is returned. Because of this, the operation never fails.
  2725. *
  2726. * @param array $array
  2727. *
  2728. * @return array
  2729. *
  2730. * @link https://redis.io/commands/mget
  2731. * @example
  2732. * <pre>
  2733. * $redis->del('x', 'y', 'z', 'h'); // remove x y z
  2734. * $redis->mset(array('x' => 'a', 'y' => 'b', 'z' => 'c'));
  2735. * $redis->hset('h', 'field', 'value');
  2736. * var_dump($redis->mget(array('x', 'y', 'z', 'h')));
  2737. * // Output:
  2738. * // array(3) {
  2739. * // [0]=> string(1) "a"
  2740. * // [1]=> string(1) "b"
  2741. * // [2]=> string(1) "c"
  2742. * // [3]=> bool(false)
  2743. * // }
  2744. * </pre>
  2745. */
  2746. public function mget(array $array)
  2747. {
  2748. }
  2749. /**
  2750. * @see mset()
  2751. * @param array $array
  2752. * @return int 1 (if the keys were set) or 0 (no key was set)
  2753. *
  2754. * @link https://redis.io/commands/msetnx
  2755. */
  2756. public function msetnx(array $array)
  2757. {
  2758. }
  2759. /**
  2760. * Pops a value from the tail of a list, and pushes it to the front of another list.
  2761. * Also return this value.
  2762. *
  2763. * @since redis >= 1.1
  2764. *
  2765. * @param string $srcKey
  2766. * @param string $dstKey
  2767. *
  2768. * @return string|mixed|bool The element that was moved in case of success, FALSE in case of failure.
  2769. *
  2770. * @link https://redis.io/commands/rpoplpush
  2771. * @example
  2772. * <pre>
  2773. * $redis->del('x', 'y');
  2774. *
  2775. * $redis->lPush('x', 'abc');
  2776. * $redis->lPush('x', 'def');
  2777. * $redis->lPush('y', '123');
  2778. * $redis->lPush('y', '456');
  2779. *
  2780. * // move the last of x to the front of y.
  2781. * var_dump($redis->rpoplpush('x', 'y'));
  2782. * var_dump($redis->lRange('x', 0, -1));
  2783. * var_dump($redis->lRange('y', 0, -1));
  2784. *
  2785. * //Output:
  2786. * //
  2787. * //string(3) "abc"
  2788. * //array(1) {
  2789. * // [0]=>
  2790. * // string(3) "def"
  2791. * //}
  2792. * //array(3) {
  2793. * // [0]=>
  2794. * // string(3) "abc"
  2795. * // [1]=>
  2796. * // string(3) "456"
  2797. * // [2]=>
  2798. * // string(3) "123"
  2799. * //}
  2800. * </pre>
  2801. */
  2802. public function rpoplpush($srcKey, $dstKey)
  2803. {
  2804. }
  2805. /**
  2806. * A blocking version of rpoplpush, with an integral timeout in the third parameter.
  2807. *
  2808. * @param string $srcKey
  2809. * @param string $dstKey
  2810. * @param int $timeout
  2811. *
  2812. * @return string|mixed|bool The element that was moved in case of success, FALSE in case of timeout
  2813. *
  2814. * @link https://redis.io/commands/brpoplpush
  2815. */
  2816. public function brpoplpush($srcKey, $dstKey, $timeout)
  2817. {
  2818. }
  2819. /**
  2820. * Adds the specified member with a given score to the sorted set stored at key
  2821. *
  2822. * @param string $key Required key
  2823. * @param array|float $options Options if needed or score if omitted
  2824. * @param float|string|mixed $score1 Required score or value if options omitted
  2825. * @param string|float|mixed $value1 Required value or optional score if options omitted
  2826. * @param float|string|mixed $score2 Optional score or value if options omitted
  2827. * @param string|float|mixed $value2 Optional value or score if options omitted
  2828. * @param float|string|mixed $scoreN Optional score or value if options omitted
  2829. * @param string|float|mixed $valueN Optional value or score if options omitted
  2830. *
  2831. * @return int Number of values added
  2832. *
  2833. * @link https://redis.io/commands/zadd
  2834. * @example
  2835. * <pre>
  2836. * <pre>
  2837. * $redis->zAdd('z', 1, 'v1', 2, 'v2', 3, 'v3', 4, 'v4' ); // int(2)
  2838. * $redis->zRem('z', 'v2', 'v3'); // int(2)
  2839. * $redis->zAdd('z', ['NX'], 5, 'v5'); // int(1)
  2840. * $redis->zAdd('z', ['NX'], 6, 'v5'); // int(0)
  2841. * $redis->zAdd('z', 7, 'v6'); // int(1)
  2842. * $redis->zAdd('z', 8, 'v6'); // int(0)
  2843. *
  2844. * var_dump( $redis->zRange('z', 0, -1) );
  2845. * // Output:
  2846. * // array(4) {
  2847. * // [0]=> string(2) "v1"
  2848. * // [1]=> string(2) "v4"
  2849. * // [2]=> string(2) "v5"
  2850. * // [3]=> string(2) "v8"
  2851. * // }
  2852. *
  2853. * var_dump( $redis->zRange('z', 0, -1, true) );
  2854. * // Output:
  2855. * // array(4) {
  2856. * // ["v1"]=> float(1)
  2857. * // ["v4"]=> float(4)
  2858. * // ["v5"]=> float(5)
  2859. * // ["v6"]=> float(8)
  2860. * </pre>
  2861. * </pre>
  2862. */
  2863. public function zAdd($key, $options, $score1, $value1 = null, $score2 = null, $value2 = null, $scoreN = null, $valueN = null)
  2864. {
  2865. }
  2866. /**
  2867. * Returns a range of elements from the ordered set stored at the specified key,
  2868. * with values in the range [start, end]. start and stop are interpreted as zero-based indices:
  2869. * 0 the first element,
  2870. * 1 the second ...
  2871. * -1 the last element,
  2872. * -2 the penultimate ...
  2873. *
  2874. * @param string $key
  2875. * @param int $start
  2876. * @param int $end
  2877. * @param bool $withscores
  2878. *
  2879. * @return array Array containing the values in specified range.
  2880. *
  2881. * @link https://redis.io/commands/zrange
  2882. * @example
  2883. * <pre>
  2884. * $redis->zAdd('key1', 0, 'val0');
  2885. * $redis->zAdd('key1', 2, 'val2');
  2886. * $redis->zAdd('key1', 10, 'val10');
  2887. * $redis->zRange('key1', 0, -1); // array('val0', 'val2', 'val10')
  2888. * // with scores
  2889. * $redis->zRange('key1', 0, -1, true); // array('val0' => 0, 'val2' => 2, 'val10' => 10)
  2890. * </pre>
  2891. */
  2892. public function zRange($key, $start, $end, $withscores = null)
  2893. {
  2894. }
  2895. /**
  2896. * Deletes a specified member from the ordered set.
  2897. *
  2898. * @param string $key
  2899. * @param string|mixed $member1
  2900. * @param string|mixed ...$otherMembers
  2901. *
  2902. * @return int Number of deleted values
  2903. *
  2904. * @link https://redis.io/commands/zrem
  2905. * @example
  2906. * <pre>
  2907. * $redis->zAdd('z', 1, 'v1', 2, 'v2', 3, 'v3', 4, 'v4' ); // int(2)
  2908. * $redis->zRem('z', 'v2', 'v3'); // int(2)
  2909. * var_dump( $redis->zRange('z', 0, -1) );
  2910. * //// Output:
  2911. * // array(2) {
  2912. * // [0]=> string(2) "v1"
  2913. * // [1]=> string(2) "v4"
  2914. * // }
  2915. * </pre>
  2916. */
  2917. public function zRem($key, $member1, ...$otherMembers)
  2918. {
  2919. }
  2920. /**
  2921. * @see zRem()
  2922. * @link https://redis.io/commands/zrem
  2923. * @deprecated use Redis::zRem()
  2924. *
  2925. * @param string $key
  2926. * @param string|mixed $member1
  2927. * @param string|mixed ...$otherMembers
  2928. *
  2929. * @return int Number of deleted values
  2930. */
  2931. public function zDelete($key, $member1, ...$otherMembers)
  2932. {
  2933. }
  2934. /**
  2935. * Returns the elements of the sorted set stored at the specified key in the range [start, end]
  2936. * in reverse order. start and stop are interpretated as zero-based indices:
  2937. * 0 the first element,
  2938. * 1 the second ...
  2939. * -1 the last element,
  2940. * -2 the penultimate ...
  2941. *
  2942. * @param string $key
  2943. * @param int $start
  2944. * @param int $end
  2945. * @param bool $withscore
  2946. *
  2947. * @return array Array containing the values in specified range.
  2948. *
  2949. * @link https://redis.io/commands/zrevrange
  2950. * @example
  2951. * <pre>
  2952. * $redis->zAdd('key', 0, 'val0');
  2953. * $redis->zAdd('key', 2, 'val2');
  2954. * $redis->zAdd('key', 10, 'val10');
  2955. * $redis->zRevRange('key', 0, -1); // array('val10', 'val2', 'val0')
  2956. *
  2957. * // with scores
  2958. * $redis->zRevRange('key', 0, -1, true); // array('val10' => 10, 'val2' => 2, 'val0' => 0)
  2959. * </pre>
  2960. */
  2961. public function zRevRange($key, $start, $end, $withscore = null)
  2962. {
  2963. }
  2964. /**
  2965. * Returns the elements of the sorted set stored at the specified key which have scores in the
  2966. * range [start,end]. Adding a parenthesis before start or end excludes it from the range.
  2967. * +inf and -inf are also valid limits.
  2968. *
  2969. * zRevRangeByScore returns the same items in reverse order, when the start and end parameters are swapped.
  2970. *
  2971. * @param string $key
  2972. * @param int $start
  2973. * @param int $end
  2974. * @param array $options Two options are available:
  2975. * - withscores => TRUE,
  2976. * - and limit => array($offset, $count)
  2977. *
  2978. * @return array Array containing the values in specified range.
  2979. *
  2980. * @link https://redis.io/commands/zrangebyscore
  2981. * @example
  2982. * <pre>
  2983. * $redis->zAdd('key', 0, 'val0');
  2984. * $redis->zAdd('key', 2, 'val2');
  2985. * $redis->zAdd('key', 10, 'val10');
  2986. * $redis->zRangeByScore('key', 0, 3); // array('val0', 'val2')
  2987. * $redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE); // array('val0' => 0, 'val2' => 2)
  2988. * $redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1)); // array('val2')
  2989. * $redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE, 'limit' => array(1, 1)); // array('val2' => 2)
  2990. * </pre>
  2991. */
  2992. public function zRangeByScore($key, $start, $end, array $options = array())
  2993. {
  2994. }
  2995. /**
  2996. * @see zRangeByScore()
  2997. * @param string $key
  2998. * @param int $start
  2999. * @param int $end
  3000. * @param array $options
  3001. *
  3002. * @return array
  3003. */
  3004. public function zRevRangeByScore($key, $start, $end, array $options = array())
  3005. {
  3006. }
  3007. /**
  3008. * Returns a lexigraphical range of members in a sorted set, assuming the members have the same score. The
  3009. * min and max values are required to start with '(' (exclusive), '[' (inclusive), or be exactly the values
  3010. * '-' (negative inf) or '+' (positive inf). The command must be called with either three *or* five
  3011. * arguments or will return FALSE.
  3012. *
  3013. * @param string $key The ZSET you wish to run against.
  3014. * @param int $min The minimum alphanumeric value you wish to get.
  3015. * @param int $max The maximum alphanumeric value you wish to get.
  3016. * @param int $offset Optional argument if you wish to start somewhere other than the first element.
  3017. * @param int $limit Optional argument if you wish to limit the number of elements returned.
  3018. *
  3019. * @return array|bool Array containing the values in the specified range.
  3020. *
  3021. * @link https://redis.io/commands/zrangebylex
  3022. * @example
  3023. * <pre>
  3024. * foreach (array('a', 'b', 'c', 'd', 'e', 'f', 'g') as $char) {
  3025. * $redis->zAdd('key', $char);
  3026. * }
  3027. *
  3028. * $redis->zRangeByLex('key', '-', '[c'); // array('a', 'b', 'c')
  3029. * $redis->zRangeByLex('key', '-', '(c'); // array('a', 'b')
  3030. * $redis->zRangeByLex('key', '-', '[c'); // array('b', 'c')
  3031. * </pre>
  3032. */
  3033. public function zRangeByLex($key, $min, $max, $offset = null, $limit = null)
  3034. {
  3035. }
  3036. /**
  3037. * @see zRangeByLex()
  3038. * @param string $key
  3039. * @param int $min
  3040. * @param int $max
  3041. * @param int $offset
  3042. * @param int $limit
  3043. *
  3044. * @return array
  3045. *
  3046. * @link https://redis.io/commands/zrevrangebylex
  3047. */
  3048. public function zRevRangeByLex($key, $min, $max, $offset = null, $limit = null)
  3049. {
  3050. }
  3051. /**
  3052. * Returns the number of elements of the sorted set stored at the specified key which have
  3053. * scores in the range [start,end]. Adding a parenthesis before start or end excludes it
  3054. * from the range. +inf and -inf are also valid limits.
  3055. *
  3056. * @param string $key
  3057. * @param string $start
  3058. * @param string $end
  3059. *
  3060. * @return int the size of a corresponding zRangeByScore
  3061. *
  3062. * @link https://redis.io/commands/zcount
  3063. * @example
  3064. * <pre>
  3065. * $redis->zAdd('key', 0, 'val0');
  3066. * $redis->zAdd('key', 2, 'val2');
  3067. * $redis->zAdd('key', 10, 'val10');
  3068. * $redis->zCount('key', 0, 3); // 2, corresponding to array('val0', 'val2')
  3069. * </pre>
  3070. */
  3071. public function zCount($key, $start, $end)
  3072. {
  3073. }
  3074. /**
  3075. * Deletes the elements of the sorted set stored at the specified key which have scores in the range [start,end].
  3076. *
  3077. * @param string $key
  3078. * @param float|string $start double or "+inf" or "-inf" string
  3079. * @param float|string $end double or "+inf" or "-inf" string
  3080. *
  3081. * @return int The number of values deleted from the sorted set
  3082. *
  3083. * @link https://redis.io/commands/zremrangebyscore
  3084. * @example
  3085. * <pre>
  3086. * $redis->zAdd('key', 0, 'val0');
  3087. * $redis->zAdd('key', 2, 'val2');
  3088. * $redis->zAdd('key', 10, 'val10');
  3089. * $redis->zRemRangeByScore('key', 0, 3); // 2
  3090. * </pre>
  3091. */
  3092. public function zRemRangeByScore($key, $start, $end)
  3093. {
  3094. }
  3095. /**
  3096. * @see zRemRangeByScore()
  3097. * @deprecated use Redis::zRemRangeByScore()
  3098. *
  3099. * @param string $key
  3100. * @param float $start
  3101. * @param float $end
  3102. */
  3103. public function zDeleteRangeByScore($key, $start, $end)
  3104. {
  3105. }
  3106. /**
  3107. * Deletes the elements of the sorted set stored at the specified key which have rank in the range [start,end].
  3108. *
  3109. * @param string $key
  3110. * @param int $start
  3111. * @param int $end
  3112. *
  3113. * @return int The number of values deleted from the sorted set
  3114. *
  3115. * @link https://redis.io/commands/zremrangebyrank
  3116. * @example
  3117. * <pre>
  3118. * $redis->zAdd('key', 1, 'one');
  3119. * $redis->zAdd('key', 2, 'two');
  3120. * $redis->zAdd('key', 3, 'three');
  3121. * $redis->zRemRangeByRank('key', 0, 1); // 2
  3122. * $redis->zRange('key', 0, -1, array('withscores' => TRUE)); // array('three' => 3)
  3123. * </pre>
  3124. */
  3125. public function zRemRangeByRank($key, $start, $end)
  3126. {
  3127. }
  3128. /**
  3129. * @see zRemRangeByRank()
  3130. * @link https://redis.io/commands/zremrangebyscore
  3131. * @deprecated use Redis::zRemRangeByRank()
  3132. *
  3133. * @param string $key
  3134. * @param int $start
  3135. * @param int $end
  3136. */
  3137. public function zDeleteRangeByRank($key, $start, $end)
  3138. {
  3139. }
  3140. /**
  3141. * Returns the cardinality of an ordered set.
  3142. *
  3143. * @param string $key
  3144. *
  3145. * @return int the set's cardinality
  3146. *
  3147. * @link https://redis.io/commands/zsize
  3148. * @example
  3149. * <pre>
  3150. * $redis->zAdd('key', 0, 'val0');
  3151. * $redis->zAdd('key', 2, 'val2');
  3152. * $redis->zAdd('key', 10, 'val10');
  3153. * $redis->zCard('key'); // 3
  3154. * </pre>
  3155. */
  3156. public function zCard($key)
  3157. {
  3158. }
  3159. /**
  3160. * @see zCard()
  3161. * @deprecated use Redis::zCard()
  3162. *
  3163. * @param string $key
  3164. * @return int
  3165. */
  3166. public function zSize($key)
  3167. {
  3168. }
  3169. /**
  3170. * Returns the score of a given member in the specified sorted set.
  3171. *
  3172. * @param string $key
  3173. * @param string|mixed $member
  3174. *
  3175. * @return float|bool false if member or key not exists
  3176. *
  3177. * @link https://redis.io/commands/zscore
  3178. * @example
  3179. * <pre>
  3180. * $redis->zAdd('key', 2.5, 'val2');
  3181. * $redis->zScore('key', 'val2'); // 2.5
  3182. * </pre>
  3183. */
  3184. public function zScore($key, $member)
  3185. {
  3186. }
  3187. /**
  3188. * Returns the rank of a given member in the specified sorted set, starting at 0 for the item
  3189. * with the smallest score. zRevRank starts at 0 for the item with the largest score.
  3190. *
  3191. * @param string $key
  3192. * @param string|mixed $member
  3193. *
  3194. * @return int|bool the item's score, or false if key or member is not exists
  3195. *
  3196. * @link https://redis.io/commands/zrank
  3197. * @example
  3198. * <pre>
  3199. * $redis->del('z');
  3200. * $redis->zAdd('key', 1, 'one');
  3201. * $redis->zAdd('key', 2, 'two');
  3202. * $redis->zRank('key', 'one'); // 0
  3203. * $redis->zRank('key', 'two'); // 1
  3204. * $redis->zRevRank('key', 'one'); // 1
  3205. * $redis->zRevRank('key', 'two'); // 0
  3206. * </pre>
  3207. */
  3208. public function zRank($key, $member)
  3209. {
  3210. }
  3211. /**
  3212. * @see zRank()
  3213. * @param string $key
  3214. * @param string|mixed $member
  3215. *
  3216. * @return int|bool the item's score, false - if key or member is not exists
  3217. *
  3218. * @link https://redis.io/commands/zrevrank
  3219. */
  3220. public function zRevRank($key, $member)
  3221. {
  3222. }
  3223. /**
  3224. * Increments the score of a member from a sorted set by a given amount.
  3225. *
  3226. * @param string $key
  3227. * @param float $value (double) value that will be added to the member's score
  3228. * @param string $member
  3229. *
  3230. * @return float the new value
  3231. *
  3232. * @link https://redis.io/commands/zincrby
  3233. * @example
  3234. * <pre>
  3235. * $redis->del('key');
  3236. * $redis->zIncrBy('key', 2.5, 'member1'); // key or member1 didn't exist, so member1's score is to 0
  3237. * // before the increment and now has the value 2.5
  3238. * $redis->zIncrBy('key', 1, 'member1'); // 3.5
  3239. * </pre>
  3240. */
  3241. public function zIncrBy($key, $value, $member)
  3242. {
  3243. }
  3244. /**
  3245. * Creates an union of sorted sets given in second argument.
  3246. * The result of the union will be stored in the sorted set defined by the first argument.
  3247. * The third optionnel argument defines weights to apply to the sorted sets in input.
  3248. * In this case, the weights will be multiplied by the score of each element in the sorted set
  3249. * before applying the aggregation. The forth argument defines the AGGREGATE option which
  3250. * specify how the results of the union are aggregated.
  3251. *
  3252. * @param string $output
  3253. * @param array $zSetKeys
  3254. * @param array $weights
  3255. * @param string $aggregateFunction Either "SUM", "MIN", or "MAX": defines the behaviour to use on
  3256. * duplicate entries during the zUnionStore
  3257. *
  3258. * @return int The number of values in the new sorted set
  3259. *
  3260. * @link https://redis.io/commands/zunionstore
  3261. * @example
  3262. * <pre>
  3263. * $redis->del('k1');
  3264. * $redis->del('k2');
  3265. * $redis->del('k3');
  3266. * $redis->del('ko1');
  3267. * $redis->del('ko2');
  3268. * $redis->del('ko3');
  3269. *
  3270. * $redis->zAdd('k1', 0, 'val0');
  3271. * $redis->zAdd('k1', 1, 'val1');
  3272. *
  3273. * $redis->zAdd('k2', 2, 'val2');
  3274. * $redis->zAdd('k2', 3, 'val3');
  3275. *
  3276. * $redis->zUnionStore('ko1', array('k1', 'k2')); // 4, 'ko1' => array('val0', 'val1', 'val2', 'val3')
  3277. *
  3278. * // Weighted zUnionStore
  3279. * $redis->zUnionStore('ko2', array('k1', 'k2'), array(1, 1)); // 4, 'ko2' => array('val0', 'val1', 'val2', 'val3')
  3280. * $redis->zUnionStore('ko3', array('k1', 'k2'), array(5, 1)); // 4, 'ko3' => array('val0', 'val2', 'val3', 'val1')
  3281. * </pre>
  3282. */
  3283. public function zUnionStore($output, $zSetKeys, array $weights = null, $aggregateFunction = 'SUM')
  3284. {
  3285. }
  3286. /**
  3287. * @see zUnionStore
  3288. * @deprecated use Redis::zUnionStore()
  3289. *
  3290. * @param string $Output
  3291. * @param array $ZSetKeys
  3292. * @param array|null $Weights
  3293. * @param string $aggregateFunction
  3294. */
  3295. public function zUnion($Output, $ZSetKeys, array $Weights = null, $aggregateFunction = 'SUM')
  3296. {
  3297. }
  3298. /**
  3299. * Creates an intersection of sorted sets given in second argument.
  3300. * The result of the union will be stored in the sorted set defined by the first argument.
  3301. * The third optional argument defines weights to apply to the sorted sets in input.
  3302. * In this case, the weights will be multiplied by the score of each element in the sorted set
  3303. * before applying the aggregation. The forth argument defines the AGGREGATE option which
  3304. * specify how the results of the union are aggregated.
  3305. *
  3306. * @param string $output
  3307. * @param array $zSetKeys
  3308. * @param array $weights
  3309. * @param string $aggregateFunction Either "SUM", "MIN", or "MAX":
  3310. * defines the behaviour to use on duplicate entries during the zInterStore.
  3311. *
  3312. * @return int The number of values in the new sorted set.
  3313. *
  3314. * @link https://redis.io/commands/zinterstore
  3315. * @example
  3316. * <pre>
  3317. * $redis->del('k1');
  3318. * $redis->del('k2');
  3319. * $redis->del('k3');
  3320. *
  3321. * $redis->del('ko1');
  3322. * $redis->del('ko2');
  3323. * $redis->del('ko3');
  3324. * $redis->del('ko4');
  3325. *
  3326. * $redis->zAdd('k1', 0, 'val0');
  3327. * $redis->zAdd('k1', 1, 'val1');
  3328. * $redis->zAdd('k1', 3, 'val3');
  3329. *
  3330. * $redis->zAdd('k2', 2, 'val1');
  3331. * $redis->zAdd('k2', 3, 'val3');
  3332. *
  3333. * $redis->zInterStore('ko1', array('k1', 'k2')); // 2, 'ko1' => array('val1', 'val3')
  3334. * $redis->zInterStore('ko2', array('k1', 'k2'), array(1, 1)); // 2, 'ko2' => array('val1', 'val3')
  3335. *
  3336. * // Weighted zInterStore
  3337. * $redis->zInterStore('ko3', array('k1', 'k2'), array(1, 5), 'min'); // 2, 'ko3' => array('val1', 'val3')
  3338. * $redis->zInterStore('ko4', array('k1', 'k2'), array(1, 5), 'max'); // 2, 'ko4' => array('val3', 'val1')
  3339. * </pre>
  3340. */
  3341. public function zInterStore($output, $zSetKeys, array $weights = null, $aggregateFunction = 'SUM')
  3342. {
  3343. }
  3344. /**
  3345. * @see zInterStore
  3346. * @deprecated use Redis::zInterStore()
  3347. *
  3348. * @param $Output
  3349. * @param $ZSetKeys
  3350. * @param array|null $Weights
  3351. * @param string $aggregateFunction
  3352. */
  3353. public function zInter($Output, $ZSetKeys, array $Weights = null, $aggregateFunction = 'SUM')
  3354. {
  3355. }
  3356. /**
  3357. * Scan a sorted set for members, with optional pattern and count
  3358. *
  3359. * @param string $key String, the set to scan.
  3360. * @param int $iterator Long (reference), initialized to NULL.
  3361. * @param string $pattern String (optional), the pattern to match.
  3362. * @param int $count How many keys to return per iteration (Redis might return a different number).
  3363. *
  3364. * @return array|bool PHPRedis will return matching keys from Redis, or FALSE when iteration is complete
  3365. *
  3366. * @link https://redis.io/commands/zscan
  3367. * @example
  3368. * <pre>
  3369. * $iterator = null;
  3370. * while ($members = $redis-zscan('zset', $iterator)) {
  3371. * foreach ($members as $member => $score) {
  3372. * echo $member . ' => ' . $score . PHP_EOL;
  3373. * }
  3374. * }
  3375. * </pre>
  3376. */
  3377. public function zScan($key, &$iterator, $pattern = null, $count = 0)
  3378. {
  3379. }
  3380. /**
  3381. * Block until Redis can pop the highest or lowest scoring members from one or more ZSETs.
  3382. * There are two commands (BZPOPMIN and BZPOPMAX for popping the lowest and highest scoring elements respectively.)
  3383. *
  3384. * @param string|array $key1
  3385. * @param string|array $key2 ...
  3386. * @param int $timeout
  3387. *
  3388. * @return array Either an array with the key member and score of the highest or lowest element or an empty array
  3389. * if the timeout was reached without an element to pop.
  3390. *
  3391. * @since >= 5.0
  3392. * @link https://redis.io/commands/bzpopmax
  3393. * @example
  3394. * <pre>
  3395. * // Wait up to 5 seconds to pop the *lowest* scoring member from sets `zs1` and `zs2`.
  3396. * $redis->bzPopMin(['zs1', 'zs2'], 5);
  3397. * $redis->bzPopMin('zs1', 'zs2', 5);
  3398. *
  3399. * // Wait up to 5 seconds to pop the *highest* scoring member from sets `zs1` and `zs2`
  3400. * $redis->bzPopMax(['zs1', 'zs2'], 5);
  3401. * $redis->bzPopMax('zs1', 'zs2', 5);
  3402. * </pre>
  3403. */
  3404. public function bzPopMax($key1, $key2, $timeout)
  3405. {
  3406. }
  3407. /**
  3408. * @param string|array $key1
  3409. * @param string|array $key2 ...
  3410. * @param int $timeout
  3411. *
  3412. * @return array Either an array with the key member and score of the highest or lowest element or an empty array
  3413. * if the timeout was reached without an element to pop.
  3414. *
  3415. * @see bzPopMax
  3416. * @since >= 5.0
  3417. * @link https://redis.io/commands/bzpopmin
  3418. */
  3419. public function bzPopMin($key1, $key2, $timeout)
  3420. {
  3421. }
  3422. /**
  3423. * Can pop the highest scoring members from one ZSET.
  3424. *
  3425. * @param string $key
  3426. * @param int $count
  3427. *
  3428. * @return array Either an array with the key member and score of the highest element or an empty array
  3429. * if there is no element to pop.
  3430. *
  3431. * @since >= 5.0
  3432. * @link https://redis.io/commands/zpopmax
  3433. * @example
  3434. * <pre>
  3435. * // Pop the *lowest* scoring member from set `zs1`.
  3436. * $redis->zPopMax('zs1');
  3437. * // Pop the *lowest* 3 scoring member from set `zs1`.
  3438. * $redis->zPopMax('zs1', 3);
  3439. * </pre>
  3440. */
  3441. public function zPopMax($key, $count = 1)
  3442. {
  3443. }
  3444. /**
  3445. * Can pop the lowest scoring members from one ZSET.
  3446. *
  3447. * @param string $key
  3448. * @param int $count
  3449. *
  3450. * @return array Either an array with the key member and score of the lowest element or an empty array
  3451. * if there is no element to pop.
  3452. *
  3453. * @since >= 5.0
  3454. * @link https://redis.io/commands/zpopmin
  3455. * @example
  3456. * <pre>
  3457. * // Pop the *lowest* scoring member from set `zs1`.
  3458. * $redis->zPopMin('zs1');
  3459. * // Pop the *lowest* 3 scoring member from set `zs1`.
  3460. * $redis->zPopMin('zs1', 3);
  3461. * </pre>
  3462. */
  3463. public function zPopMin($key, $count = 1)
  3464. {
  3465. }
  3466. /**
  3467. * Adds a value to the hash stored at key. If this value is already in the hash, FALSE is returned.
  3468. *
  3469. * @param string $key
  3470. * @param string $hashKey
  3471. * @param string $value
  3472. *
  3473. * @return int|bool
  3474. * - 1 if value didn't exist and was added successfully,
  3475. * - 0 if the value was already present and was replaced, FALSE if there was an error.
  3476. *
  3477. * @link https://redis.io/commands/hset
  3478. * @example
  3479. * <pre>
  3480. * $redis->del('h')
  3481. * $redis->hSet('h', 'key1', 'hello'); // 1, 'key1' => 'hello' in the hash at "h"
  3482. * $redis->hGet('h', 'key1'); // returns "hello"
  3483. *
  3484. * $redis->hSet('h', 'key1', 'plop'); // 0, value was replaced.
  3485. * $redis->hGet('h', 'key1'); // returns "plop"
  3486. * </pre>
  3487. */
  3488. public function hSet($key, $hashKey, $value)
  3489. {
  3490. }
  3491. /**
  3492. * Adds a value to the hash stored at key only if this field isn't already in the hash.
  3493. *
  3494. * @param string $key
  3495. * @param string $hashKey
  3496. * @param string $value
  3497. *
  3498. * @return bool TRUE if the field was set, FALSE if it was already present.
  3499. *
  3500. * @link https://redis.io/commands/hsetnx
  3501. * @example
  3502. * <pre>
  3503. * $redis->del('h')
  3504. * $redis->hSetNx('h', 'key1', 'hello'); // TRUE, 'key1' => 'hello' in the hash at "h"
  3505. * $redis->hSetNx('h', 'key1', 'world'); // FALSE, 'key1' => 'hello' in the hash at "h". No change since the field
  3506. * wasn't replaced.
  3507. * </pre>
  3508. */
  3509. public function hSetNx($key, $hashKey, $value)
  3510. {
  3511. }
  3512. /**
  3513. * Gets a value from the hash stored at key.
  3514. * If the hash table doesn't exist, or the key doesn't exist, FALSE is returned.
  3515. *
  3516. * @param string $key
  3517. * @param string $hashKey
  3518. *
  3519. * @return string The value, if the command executed successfully BOOL FALSE in case of failure
  3520. *
  3521. * @link https://redis.io/commands/hget
  3522. */
  3523. public function hGet($key, $hashKey)
  3524. {
  3525. }
  3526. /**
  3527. * Returns the length of a hash, in number of items
  3528. *
  3529. * @param string $key
  3530. *
  3531. * @return int|bool the number of items in a hash, FALSE if the key doesn't exist or isn't a hash
  3532. *
  3533. * @link https://redis.io/commands/hlen
  3534. * @example
  3535. * <pre>
  3536. * $redis->del('h')
  3537. * $redis->hSet('h', 'key1', 'hello');
  3538. * $redis->hSet('h', 'key2', 'plop');
  3539. * $redis->hLen('h'); // returns 2
  3540. * </pre>
  3541. */
  3542. public function hLen($key)
  3543. {
  3544. }
  3545. /**
  3546. * Removes a values from the hash stored at key.
  3547. * If the hash table doesn't exist, or the key doesn't exist, FALSE is returned.
  3548. *
  3549. * @param string $key
  3550. * @param string $hashKey1
  3551. * @param string ...$otherHashKeys
  3552. *
  3553. * @return int|bool Number of deleted fields
  3554. *
  3555. * @link https://redis.io/commands/hdel
  3556. * @example
  3557. * <pre>
  3558. * $redis->hMSet('h',
  3559. * array(
  3560. * 'f1' => 'v1',
  3561. * 'f2' => 'v2',
  3562. * 'f3' => 'v3',
  3563. * 'f4' => 'v4',
  3564. * ));
  3565. *
  3566. * var_dump( $redis->hDel('h', 'f1') ); // int(1)
  3567. * var_dump( $redis->hDel('h', 'f2', 'f3') ); // int(2)
  3568. * s
  3569. * var_dump( $redis->hGetAll('h') );
  3570. * //// Output:
  3571. * // array(1) {
  3572. * // ["f4"]=> string(2) "v4"
  3573. * // }
  3574. * </pre>
  3575. */
  3576. public function hDel($key, $hashKey1, ...$otherHashKeys)
  3577. {
  3578. }
  3579. /**
  3580. * Returns the keys in a hash, as an array of strings.
  3581. *
  3582. * @param string $key
  3583. *
  3584. * @return array An array of elements, the keys of the hash. This works like PHP's array_keys().
  3585. *
  3586. * @link https://redis.io/commands/hkeys
  3587. * @example
  3588. * <pre>
  3589. * $redis->del('h');
  3590. * $redis->hSet('h', 'a', 'x');
  3591. * $redis->hSet('h', 'b', 'y');
  3592. * $redis->hSet('h', 'c', 'z');
  3593. * $redis->hSet('h', 'd', 't');
  3594. * var_dump($redis->hKeys('h'));
  3595. *
  3596. * // Output:
  3597. * // array(4) {
  3598. * // [0]=>
  3599. * // string(1) "a"
  3600. * // [1]=>
  3601. * // string(1) "b"
  3602. * // [2]=>
  3603. * // string(1) "c"
  3604. * // [3]=>
  3605. * // string(1) "d"
  3606. * // }
  3607. * // The order is random and corresponds to redis' own internal representation of the set structure.
  3608. * </pre>
  3609. */
  3610. public function hKeys($key)
  3611. {
  3612. }
  3613. /**
  3614. * Returns the values in a hash, as an array of strings.
  3615. *
  3616. * @param string $key
  3617. *
  3618. * @return array An array of elements, the values of the hash. This works like PHP's array_values().
  3619. *
  3620. * @link https://redis.io/commands/hvals
  3621. * @example
  3622. * <pre>
  3623. * $redis->del('h');
  3624. * $redis->hSet('h', 'a', 'x');
  3625. * $redis->hSet('h', 'b', 'y');
  3626. * $redis->hSet('h', 'c', 'z');
  3627. * $redis->hSet('h', 'd', 't');
  3628. * var_dump($redis->hVals('h'));
  3629. *
  3630. * // Output
  3631. * // array(4) {
  3632. * // [0]=>
  3633. * // string(1) "x"
  3634. * // [1]=>
  3635. * // string(1) "y"
  3636. * // [2]=>
  3637. * // string(1) "z"
  3638. * // [3]=>
  3639. * // string(1) "t"
  3640. * // }
  3641. * // The order is random and corresponds to redis' own internal representation of the set structure.
  3642. * </pre>
  3643. */
  3644. public function hVals($key)
  3645. {
  3646. }
  3647. /**
  3648. * Returns the whole hash, as an array of strings indexed by strings.
  3649. *
  3650. * @param string $key
  3651. *
  3652. * @return array An array of elements, the contents of the hash.
  3653. *
  3654. * @link https://redis.io/commands/hgetall
  3655. * @example
  3656. * <pre>
  3657. * $redis->del('h');
  3658. * $redis->hSet('h', 'a', 'x');
  3659. * $redis->hSet('h', 'b', 'y');
  3660. * $redis->hSet('h', 'c', 'z');
  3661. * $redis->hSet('h', 'd', 't');
  3662. * var_dump($redis->hGetAll('h'));
  3663. *
  3664. * // Output:
  3665. * // array(4) {
  3666. * // ["a"]=>
  3667. * // string(1) "x"
  3668. * // ["b"]=>
  3669. * // string(1) "y"
  3670. * // ["c"]=>
  3671. * // string(1) "z"
  3672. * // ["d"]=>
  3673. * // string(1) "t"
  3674. * // }
  3675. * // The order is random and corresponds to redis' own internal representation of the set structure.
  3676. * </pre>
  3677. */
  3678. public function hGetAll($key)
  3679. {
  3680. }
  3681. /**
  3682. * Verify if the specified member exists in a key.
  3683. *
  3684. * @param string $key
  3685. * @param string $hashKey
  3686. *
  3687. * @return bool If the member exists in the hash table, return TRUE, otherwise return FALSE.
  3688. *
  3689. * @link https://redis.io/commands/hexists
  3690. * @example
  3691. * <pre>
  3692. * $redis->hSet('h', 'a', 'x');
  3693. * $redis->hExists('h', 'a'); // TRUE
  3694. * $redis->hExists('h', 'NonExistingKey'); // FALSE
  3695. * </pre>
  3696. */
  3697. public function hExists($key, $hashKey)
  3698. {
  3699. }
  3700. /**
  3701. * Increments the value of a member from a hash by a given amount.
  3702. *
  3703. * @param string $key
  3704. * @param string $hashKey
  3705. * @param int $value (integer) value that will be added to the member's value
  3706. *
  3707. * @return int the new value
  3708. *
  3709. * @link https://redis.io/commands/hincrby
  3710. * @example
  3711. * <pre>
  3712. * $redis->del('h');
  3713. * $redis->hIncrBy('h', 'x', 2); // returns 2: h[x] = 2 now.
  3714. * $redis->hIncrBy('h', 'x', 1); // h[x] ← 2 + 1. Returns 3
  3715. * </pre>
  3716. */
  3717. public function hIncrBy($key, $hashKey, $value)
  3718. {
  3719. }
  3720. /**
  3721. * Increment the float value of a hash field by the given amount
  3722. *
  3723. * @param string $key
  3724. * @param string $field
  3725. * @param float $increment
  3726. *
  3727. * @return float
  3728. *
  3729. * @link https://redis.io/commands/hincrbyfloat
  3730. * @example
  3731. * <pre>
  3732. * $redis = new Redis();
  3733. * $redis->connect('127.0.0.1');
  3734. * $redis->hset('h', 'float', 3);
  3735. * $redis->hset('h', 'int', 3);
  3736. * var_dump( $redis->hIncrByFloat('h', 'float', 1.5) ); // float(4.5)
  3737. *
  3738. * var_dump( $redis->hGetAll('h') );
  3739. *
  3740. * // Output
  3741. * array(2) {
  3742. * ["float"]=>
  3743. * string(3) "4.5"
  3744. * ["int"]=>
  3745. * string(1) "3"
  3746. * }
  3747. * </pre>
  3748. */
  3749. public function hIncrByFloat($key, $field, $increment)
  3750. {
  3751. }
  3752. /**
  3753. * Fills in a whole hash. Non-string values are converted to string, using the standard (string) cast.
  3754. * NULL values are stored as empty strings
  3755. *
  3756. * @param string $key
  3757. * @param array $hashKeys key → value array
  3758. *
  3759. * @return bool
  3760. *
  3761. * @link https://redis.io/commands/hmset
  3762. * @example
  3763. * <pre>
  3764. * $redis->del('user:1');
  3765. * $redis->hMSet('user:1', array('name' => 'Joe', 'salary' => 2000));
  3766. * $redis->hIncrBy('user:1', 'salary', 100); // Joe earns 100 more now.
  3767. * </pre>
  3768. */
  3769. public function hMSet($key, $hashKeys)
  3770. {
  3771. }
  3772. /**
  3773. * Retirieve the values associated to the specified fields in the hash.
  3774. *
  3775. * @param string $key
  3776. * @param array $hashKeys
  3777. *
  3778. * @return array Array An array of elements, the values of the specified fields in the hash,
  3779. * with the hash keys as array keys.
  3780. *
  3781. * @link https://redis.io/commands/hmget
  3782. * @example
  3783. * <pre>
  3784. * $redis->del('h');
  3785. * $redis->hSet('h', 'field1', 'value1');
  3786. * $redis->hSet('h', 'field2', 'value2');
  3787. * $redis->hmGet('h', array('field1', 'field2')); // returns array('field1' => 'value1', 'field2' => 'value2')
  3788. * </pre>
  3789. */
  3790. public function hMGet($key, $hashKeys)
  3791. {
  3792. }
  3793. /**
  3794. * Scan a HASH value for members, with an optional pattern and count.
  3795. *
  3796. * @param string $key
  3797. * @param int $iterator
  3798. * @param string $pattern Optional pattern to match against.
  3799. * @param int $count How many keys to return in a go (only a sugestion to Redis).
  3800. *
  3801. * @return array An array of members that match our pattern.
  3802. *
  3803. * @link https://redis.io/commands/hscan
  3804. * @example
  3805. * <pre>
  3806. * // $iterator = null;
  3807. * // while($elements = $redis->hscan('hash', $iterator)) {
  3808. * // foreach($elements as $key => $value) {
  3809. * // echo $key . ' => ' . $value . PHP_EOL;
  3810. * // }
  3811. * // }
  3812. * </pre>
  3813. */
  3814. public function hScan($key, &$iterator, $pattern = null, $count = 0)
  3815. {
  3816. }
  3817. /**
  3818. * Get the string length of the value associated with field in the hash stored at key
  3819. *
  3820. * @param string $key
  3821. * @param string $field
  3822. *
  3823. * @return int the string length of the value associated with field, or zero when field is not present in the hash
  3824. * or key does not exist at all.
  3825. *
  3826. * @link https://redis.io/commands/hstrlen
  3827. * @since >= 3.2
  3828. */
  3829. public function hStrLen(string $key, string $field)
  3830. {
  3831. }
  3832. /**
  3833. * Add one or more geospatial items to the specified key.
  3834. * This function must be called with at least one longitude, latitude, member triplet.
  3835. *
  3836. * @param string $key
  3837. * @param float $longitude
  3838. * @param float $latitude
  3839. * @param string $member
  3840. *
  3841. * @return int The number of elements added to the geospatial key
  3842. *
  3843. * @link https://redis.io/commands/geoadd
  3844. * @since >=3.2
  3845. *
  3846. * @example
  3847. * <pre>
  3848. * $redis->del("myplaces");
  3849. *
  3850. * // Since the key will be new, $result will be 2
  3851. * $result = $redis->geoAdd(
  3852. * "myplaces",
  3853. * -122.431, 37.773, "San Francisco",
  3854. * -157.858, 21.315, "Honolulu"
  3855. * ); // 2
  3856. * </pre>
  3857. */
  3858. public function geoadd($key, $longitude, $latitude, $member)
  3859. {
  3860. }
  3861. /**
  3862. * Retrieve Geohash strings for one or more elements of a geospatial index.
  3863. * @param string $key
  3864. * @param string ...$member variadic list of members
  3865. *
  3866. * @return array One or more Redis Geohash encoded strings
  3867. *
  3868. * @link https://redis.io/commands/geohash
  3869. * @since >=3.2
  3870. *
  3871. * @example
  3872. * <pre>
  3873. * $redis->geoAdd("hawaii", -157.858, 21.306, "Honolulu", -156.331, 20.798, "Maui");
  3874. * $hashes = $redis->geoHash("hawaii", "Honolulu", "Maui");
  3875. * var_dump($hashes);
  3876. * // Output: array(2) {
  3877. * // [0]=>
  3878. * // string(11) "87z9pyek3y0"
  3879. * // [1]=>
  3880. * // string(11) "8e8y6d5jps0"
  3881. * // }
  3882. * </pre>
  3883. */
  3884. public function geohash($key, ...$member)
  3885. {
  3886. }
  3887. /**
  3888. * Return longitude, latitude positions for each requested member.
  3889. *
  3890. * @param string $key
  3891. * @param string $member
  3892. * @return array One or more longitude/latitude positions
  3893. *
  3894. * @link https://redis.io/commands/geopos
  3895. * @since >=3.2
  3896. *
  3897. * @example
  3898. * <pre>
  3899. * $redis->geoAdd("hawaii", -157.858, 21.306, "Honolulu", -156.331, 20.798, "Maui");
  3900. * $positions = $redis->geoPos("hawaii", "Honolulu", "Maui");
  3901. * var_dump($positions);
  3902. *
  3903. * // Output:
  3904. * array(2) {
  3905. * [0]=> array(2) {
  3906. * [0]=> string(22) "-157.85800248384475708"
  3907. * [1]=> string(19) "21.3060004581273077"
  3908. * }
  3909. * [1]=> array(2) {
  3910. * [0]=> string(22) "-156.33099943399429321"
  3911. * [1]=> string(20) "20.79799924753607598"
  3912. * }
  3913. * }
  3914. * </pre>
  3915. */
  3916. public function geopos(string $key, string $member)
  3917. {
  3918. }
  3919. /**
  3920. * Return the distance between two members in a geospatial set.
  3921. *
  3922. * If units are passed it must be one of the following values:
  3923. * - 'm' => Meters
  3924. * - 'km' => Kilometers
  3925. * - 'mi' => Miles
  3926. * - 'ft' => Feet
  3927. *
  3928. * @param string $key
  3929. * @param string $member1
  3930. * @param string $member2
  3931. * @param string|null $unit
  3932. *
  3933. * @return float The distance between the two passed members in the units requested (meters by default)
  3934. *
  3935. * @link https://redis.io/commands/geodist
  3936. * @since >=3.2
  3937. *
  3938. * @example
  3939. * <pre>
  3940. * $redis->geoAdd("hawaii", -157.858, 21.306, "Honolulu", -156.331, 20.798, "Maui");
  3941. *
  3942. * $meters = $redis->geoDist("hawaii", "Honolulu", "Maui");
  3943. * $kilometers = $redis->geoDist("hawaii", "Honolulu", "Maui", 'km');
  3944. * $miles = $redis->geoDist("hawaii", "Honolulu", "Maui", 'mi');
  3945. * $feet = $redis->geoDist("hawaii", "Honolulu", "Maui", 'ft');
  3946. *
  3947. * echo "Distance between Honolulu and Maui:\n";
  3948. * echo " meters : $meters\n";
  3949. * echo " kilometers: $kilometers\n";
  3950. * echo " miles : $miles\n";
  3951. * echo " feet : $feet\n";
  3952. *
  3953. * // Bad unit
  3954. * $inches = $redis->geoDist("hawaii", "Honolulu", "Maui", 'in');
  3955. * echo "Invalid unit returned:\n";
  3956. * var_dump($inches);
  3957. *
  3958. * // Output
  3959. * Distance between Honolulu and Maui:
  3960. * meters : 168275.204
  3961. * kilometers: 168.2752
  3962. * miles : 104.5616
  3963. * feet : 552084.0028
  3964. * Invalid unit returned:
  3965. * bool(false)
  3966. * </pre>
  3967. */
  3968. public function geodist($key, $member1, $member2, $unit = null)
  3969. {
  3970. }
  3971. /**
  3972. * Return members of a set with geospatial information that are within the radius specified by the caller.
  3973. *
  3974. * @param $key
  3975. * @param $longitude
  3976. * @param $latitude
  3977. * @param $radius
  3978. * @param $unit
  3979. * @param array|null $options
  3980. * <pre>
  3981. * |Key |Value |Description |
  3982. * |------------|---------------|---------------------------------------------------|
  3983. * |COUNT |integer > 0 |Limit how many results are returned |
  3984. * | |WITHCOORD |Return longitude and latitude of matching members |
  3985. * | |WITHDIST |Return the distance from the center |
  3986. * | |WITHHASH |Return the raw geohash-encoded score |
  3987. * | |ASC |Sort results in ascending order |
  3988. * | |DESC |Sort results in descending order |
  3989. * |STORE |key |Store results in key |
  3990. * |STOREDIST |key |Store the results as distances in key |
  3991. * </pre>
  3992. * Note: It doesn't make sense to pass both ASC and DESC options but if both are passed
  3993. * the last one passed will be used.
  3994. * Note: When using STORE[DIST] in Redis Cluster, the store key must has to the same slot as
  3995. * the query key or you will get a CROSSLOT error.
  3996. * @return mixed When no STORE option is passed, this function returns an array of results.
  3997. * If it is passed this function returns the number of stored entries.
  3998. *
  3999. * @link https://redis.io/commands/georadius
  4000. * @since >= 3.2
  4001. * @example
  4002. * <pre>
  4003. * // Add some cities
  4004. * $redis->geoAdd("hawaii", -157.858, 21.306, "Honolulu", -156.331, 20.798, "Maui");
  4005. *
  4006. * echo "Within 300 miles of Honolulu:\n";
  4007. * var_dump($redis->geoRadius("hawaii", -157.858, 21.306, 300, 'mi'));
  4008. *
  4009. * echo "\nWithin 300 miles of Honolulu with distances:\n";
  4010. * $options = ['WITHDIST'];
  4011. * var_dump($redis->geoRadius("hawaii", -157.858, 21.306, 300, 'mi', $options));
  4012. *
  4013. * echo "\nFirst result within 300 miles of Honolulu with distances:\n";
  4014. * $options['count'] = 1;
  4015. * var_dump($redis->geoRadius("hawaii", -157.858, 21.306, 300, 'mi', $options));
  4016. *
  4017. * echo "\nFirst result within 300 miles of Honolulu with distances in descending sort order:\n";
  4018. * $options[] = 'DESC';
  4019. * var_dump($redis->geoRadius("hawaii", -157.858, 21.306, 300, 'mi', $options));
  4020. *
  4021. * // Output
  4022. * Within 300 miles of Honolulu:
  4023. * array(2) {
  4024. * [0]=> string(8) "Honolulu"
  4025. * [1]=> string(4) "Maui"
  4026. * }
  4027. *
  4028. * Within 300 miles of Honolulu with distances:
  4029. * array(2) {
  4030. * [0]=>
  4031. * array(2) {
  4032. * [0]=>
  4033. * string(8) "Honolulu"
  4034. * [1]=>
  4035. * string(6) "0.0002"
  4036. * }
  4037. * [1]=>
  4038. * array(2) {
  4039. * [0]=>
  4040. * string(4) "Maui"
  4041. * [1]=>
  4042. * string(8) "104.5615"
  4043. * }
  4044. * }
  4045. *
  4046. * First result within 300 miles of Honolulu with distances:
  4047. * array(1) {
  4048. * [0]=>
  4049. * array(2) {
  4050. * [0]=>
  4051. * string(8) "Honolulu"
  4052. * [1]=>
  4053. * string(6) "0.0002"
  4054. * }
  4055. * }
  4056. *
  4057. * First result within 300 miles of Honolulu with distances in descending sort order:
  4058. * array(1) {
  4059. * [0]=>
  4060. * array(2) {
  4061. * [0]=>
  4062. * string(4) "Maui"
  4063. * [1]=>
  4064. * string(8) "104.5615"
  4065. * }
  4066. * }
  4067. * </pre>
  4068. */
  4069. public function georadius($key, $longitude, $latitude, $radius, $unit, array $options = null)
  4070. {
  4071. }
  4072. /**
  4073. * This method is identical to geoRadius except that instead of passing a longitude and latitude as the "source"
  4074. * you pass an existing member in the geospatial set
  4075. *
  4076. * @param string $key
  4077. * @param string $member
  4078. * @param $radius
  4079. * @param $units
  4080. * @param array|null $options see georadius
  4081. *
  4082. * @return array The zero or more entries that are close enough to the member given the distance and radius specified
  4083. *
  4084. * @link https://redis.io/commands/georadiusbymember
  4085. * @since >= 3.2
  4086. * @see georadius
  4087. * @example
  4088. * <pre>
  4089. * $redis->geoAdd("hawaii", -157.858, 21.306, "Honolulu", -156.331, 20.798, "Maui");
  4090. *
  4091. * echo "Within 300 miles of Honolulu:\n";
  4092. * var_dump($redis->geoRadiusByMember("hawaii", "Honolulu", 300, 'mi'));
  4093. *
  4094. * echo "\nFirst match within 300 miles of Honolulu:\n";
  4095. * var_dump($redis->geoRadiusByMember("hawaii", "Honolulu", 300, 'mi', ['count' => 1]));
  4096. *
  4097. * // Output
  4098. * Within 300 miles of Honolulu:
  4099. * array(2) {
  4100. * [0]=> string(8) "Honolulu"
  4101. * [1]=> string(4) "Maui"
  4102. * }
  4103. *
  4104. * First match within 300 miles of Honolulu:
  4105. * array(1) {
  4106. * [0]=> string(8) "Honolulu"
  4107. * }
  4108. * </pre>
  4109. */
  4110. public function georadiusbymember($key, $member, $radius, $units, array $options = null)
  4111. {
  4112. }
  4113. /**
  4114. * Get or Set the redis config keys.
  4115. *
  4116. * @param string $operation either `GET` or `SET`
  4117. * @param string $key for `SET`, glob-pattern for `GET`
  4118. * @param string|mixed $value optional string (only for `SET`)
  4119. *
  4120. * @return array Associative array for `GET`, key -> value
  4121. *
  4122. * @link https://redis.io/commands/config-get
  4123. * @example
  4124. * <pre>
  4125. * $redis->config("GET", "*max-*-entries*");
  4126. * $redis->config("SET", "dir", "/var/run/redis/dumps/");
  4127. * </pre>
  4128. */
  4129. public function config($operation, $key, $value)
  4130. {
  4131. }
  4132. /**
  4133. * Evaluate a LUA script serverside
  4134. *
  4135. * @param string $script
  4136. * @param array $args
  4137. * @param int $numKeys
  4138. *
  4139. * @return mixed What is returned depends on what the LUA script itself returns, which could be a scalar value
  4140. * (int/string), or an array. Arrays that are returned can also contain other arrays, if that's how it was set up in
  4141. * your LUA script. If there is an error executing the LUA script, the getLastError() function can tell you the
  4142. * message that came back from Redis (e.g. compile error).
  4143. *
  4144. * @link https://redis.io/commands/eval
  4145. * @example
  4146. * <pre>
  4147. * $redis->eval("return 1"); // Returns an integer: 1
  4148. * $redis->eval("return {1,2,3}"); // Returns Array(1,2,3)
  4149. * $redis->del('mylist');
  4150. * $redis->rpush('mylist','a');
  4151. * $redis->rpush('mylist','b');
  4152. * $redis->rpush('mylist','c');
  4153. * // Nested response: Array(1,2,3,Array('a','b','c'));
  4154. * $redis->eval("return {1,2,3,redis.call('lrange','mylist',0,-1)}}");
  4155. * </pre>
  4156. */
  4157. public function eval($script, $args = array(), $numKeys = 0)
  4158. {
  4159. }
  4160. /**
  4161. * @see eval()
  4162. * @deprecated use Redis::eval()
  4163. *
  4164. * @param string $script
  4165. * @param array $args
  4166. * @param int $numKeys
  4167. * @return mixed @see eval()
  4168. */
  4169. public function evaluate($script, $args = array(), $numKeys = 0)
  4170. {
  4171. }
  4172. /**
  4173. * Evaluate a LUA script serverside, from the SHA1 hash of the script instead of the script itself.
  4174. * In order to run this command Redis will have to have already loaded the script, either by running it or via
  4175. * the SCRIPT LOAD command.
  4176. *
  4177. * @param string $scriptSha
  4178. * @param array $args
  4179. * @param int $numKeys
  4180. *
  4181. * @return mixed @see eval()
  4182. *
  4183. * @see eval()
  4184. * @link https://redis.io/commands/evalsha
  4185. * @example
  4186. * <pre>
  4187. * $script = 'return 1';
  4188. * $sha = $redis->script('load', $script);
  4189. * $redis->evalSha($sha); // Returns 1
  4190. * </pre>
  4191. */
  4192. public function evalSha($scriptSha, $args = array(), $numKeys = 0)
  4193. {
  4194. }
  4195. /**
  4196. * @see evalSha()
  4197. * @deprecated use Redis::evalSha()
  4198. *
  4199. * @param string $scriptSha
  4200. * @param array $args
  4201. * @param int $numKeys
  4202. */
  4203. public function evaluateSha($scriptSha, $args = array(), $numKeys = 0)
  4204. {
  4205. }
  4206. /**
  4207. * Execute the Redis SCRIPT command to perform various operations on the scripting subsystem.
  4208. * @param string $command load | flush | kill | exists
  4209. * @param string $script
  4210. *
  4211. * @return mixed
  4212. *
  4213. * @link https://redis.io/commands/script-load
  4214. * @link https://redis.io/commands/script-kill
  4215. * @link https://redis.io/commands/script-flush
  4216. * @link https://redis.io/commands/script-exists
  4217. * @example
  4218. * <pre>
  4219. * $redis->script('load', $script);
  4220. * $redis->script('flush');
  4221. * $redis->script('kill');
  4222. * $redis->script('exists', $script1, [$script2, $script3, ...]);
  4223. * </pre>
  4224. *
  4225. * SCRIPT LOAD will return the SHA1 hash of the passed script on success, and FALSE on failure.
  4226. * SCRIPT FLUSH should always return TRUE
  4227. * SCRIPT KILL will return true if a script was able to be killed and false if not
  4228. * SCRIPT EXISTS will return an array with TRUE or FALSE for each passed script
  4229. */
  4230. public function script($command, $script)
  4231. {
  4232. }
  4233. /**
  4234. * The last error message (if any)
  4235. *
  4236. * @return string|null A string with the last returned script based error message, or NULL if there is no error
  4237. *
  4238. * @example
  4239. * <pre>
  4240. * $redis->eval('this-is-not-lua');
  4241. * $err = $redis->getLastError();
  4242. * // "ERR Error compiling script (new function): user_script:1: '=' expected near '-'"
  4243. * </pre>
  4244. */
  4245. public function getLastError()
  4246. {
  4247. }
  4248. /**
  4249. * Clear the last error message
  4250. *
  4251. * @return bool true
  4252. *
  4253. * @example
  4254. * <pre>
  4255. * $redis->set('x', 'a');
  4256. * $redis->incr('x');
  4257. * $err = $redis->getLastError();
  4258. * // "ERR value is not an integer or out of range"
  4259. * $redis->clearLastError();
  4260. * $err = $redis->getLastError();
  4261. * // NULL
  4262. * </pre>
  4263. */
  4264. public function clearLastError()
  4265. {
  4266. }
  4267. /**
  4268. * Issue the CLIENT command with various arguments.
  4269. * The Redis CLIENT command can be used in four ways:
  4270. * - CLIENT LIST
  4271. * - CLIENT GETNAME
  4272. * - CLIENT SETNAME [name]
  4273. * - CLIENT KILL [ip:port]
  4274. *
  4275. * @param string $command
  4276. * @param string $value
  4277. * @return mixed This will vary depending on which client command was executed:
  4278. * - CLIENT LIST will return an array of arrays with client information.
  4279. * - CLIENT GETNAME will return the client name or false if none has been set
  4280. * - CLIENT SETNAME will return true if it can be set and false if not
  4281. * - CLIENT KILL will return true if the client can be killed, and false if not
  4282. *
  4283. * Note: phpredis will attempt to reconnect so you can actually kill your own connection but may not notice losing it!
  4284. *
  4285. * @link https://redis.io/commands/client-list
  4286. * @link https://redis.io/commands/client-getname
  4287. * @link https://redis.io/commands/client-setname
  4288. * @link https://redis.io/commands/client-kill
  4289. *
  4290. * @example
  4291. * <pre>
  4292. * $redis->client('list'); // Get a list of clients
  4293. * $redis->client('getname'); // Get the name of the current connection
  4294. * $redis->client('setname', 'somename'); // Set the name of the current connection
  4295. * $redis->client('kill', <ip:port>); // Kill the process at ip:port
  4296. * </pre>
  4297. */
  4298. public function client($command, $value = '')
  4299. {
  4300. }
  4301. /**
  4302. * A utility method to prefix the value with the prefix setting for phpredis.
  4303. *
  4304. * @param mixed $value The value you wish to prefix
  4305. *
  4306. * @return string If a prefix is set up, the value now prefixed.
  4307. * If there is no prefix, the value will be returned unchanged.
  4308. *
  4309. * @example
  4310. * <pre>
  4311. * $redis->setOption(Redis::OPT_PREFIX, 'my-prefix:');
  4312. * $redis->_prefix('my-value'); // Will return 'my-prefix:my-value'
  4313. * </pre>
  4314. */
  4315. public function _prefix($value)
  4316. {
  4317. }
  4318. /**
  4319. * A utility method to unserialize data with whatever serializer is set up. If there is no serializer set, the
  4320. * value will be returned unchanged. If there is a serializer set up, and the data passed in is malformed, an
  4321. * exception will be thrown. This can be useful if phpredis is serializing values, and you return something from
  4322. * redis in a LUA script that is serialized.
  4323. *
  4324. * @param string $value The value to be unserialized
  4325. *
  4326. * @return mixed
  4327. * @example
  4328. * <pre>
  4329. * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
  4330. * $redis->_unserialize('a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}'); // Will return Array(1,2,3)
  4331. * </pre>
  4332. */
  4333. public function _unserialize($value)
  4334. {
  4335. }
  4336. /**
  4337. * A utility method to serialize values manually. This method allows you to serialize a value with whatever
  4338. * serializer is configured, manually. This can be useful for serialization/unserialization of data going in
  4339. * and out of EVAL commands as phpredis can't automatically do this itself. Note that if no serializer is
  4340. * set, phpredis will change Array values to 'Array', and Objects to 'Object'.
  4341. *
  4342. * @param mixed $value The value to be serialized.
  4343. *
  4344. * @return mixed
  4345. * @example
  4346. * <pre>
  4347. * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);
  4348. * $redis->_serialize("foo"); // returns "foo"
  4349. * $redis->_serialize(Array()); // Returns "Array"
  4350. * $redis->_serialize(new stdClass()); // Returns "Object"
  4351. *
  4352. * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
  4353. * $redis->_serialize("foo"); // Returns 's:3:"foo";'
  4354. * </pre>
  4355. */
  4356. public function _serialize($value)
  4357. {
  4358. }
  4359. /**
  4360. * Dump a key out of a redis database, the value of which can later be passed into redis using the RESTORE command.
  4361. * The data that comes out of DUMP is a binary representation of the key as Redis stores it.
  4362. * @param string $key
  4363. *
  4364. * @return string|bool The Redis encoded value of the key, or FALSE if the key doesn't exist
  4365. *
  4366. * @link https://redis.io/commands/dump
  4367. * @example
  4368. * <pre>
  4369. * $redis->set('foo', 'bar');
  4370. * $val = $redis->dump('foo'); // $val will be the Redis encoded key value
  4371. * </pre>
  4372. */
  4373. public function dump($key)
  4374. {
  4375. }
  4376. /**
  4377. * Restore a key from the result of a DUMP operation.
  4378. *
  4379. * @param string $key The key name
  4380. * @param int $ttl How long the key should live (if zero, no expire will be set on the key)
  4381. * @param string $value (binary). The Redis encoded key value (from DUMP)
  4382. *
  4383. * @return bool
  4384. *
  4385. * @link https://redis.io/commands/restore
  4386. * @example
  4387. * <pre>
  4388. * $redis->set('foo', 'bar');
  4389. * $val = $redis->dump('foo');
  4390. * $redis->restore('bar', 0, $val); // The key 'bar', will now be equal to the key 'foo'
  4391. * </pre>
  4392. */
  4393. public function restore($key, $ttl, $value)
  4394. {
  4395. }
  4396. /**
  4397. * Migrates a key to a different Redis instance.
  4398. *
  4399. * @param string $host The destination host
  4400. * @param int $port The TCP port to connect to.
  4401. * @param string $key The key to migrate.
  4402. * @param int $db The target DB.
  4403. * @param int $timeout The maximum amount of time given to this transfer.
  4404. * @param bool $copy Should we send the COPY flag to redis.
  4405. * @param bool $replace Should we send the REPLACE flag to redis.
  4406. *
  4407. * @return bool
  4408. *
  4409. * @link https://redis.io/commands/migrate
  4410. * @example
  4411. * <pre>
  4412. * $redis->migrate('backup', 6379, 'foo', 0, 3600);
  4413. * </pre>
  4414. */
  4415. public function migrate($host, $port, $key, $db, $timeout, $copy = false, $replace = false)
  4416. {
  4417. }
  4418. /**
  4419. * Return the current Redis server time.
  4420. *
  4421. * @return array If successful, the time will come back as an associative array with element zero being the
  4422. * unix timestamp, and element one being microseconds.
  4423. *
  4424. * @link https://redis.io/commands/time
  4425. * @example
  4426. * <pre>
  4427. * var_dump( $redis->time() );
  4428. * // array(2) {
  4429. * // [0] => string(10) "1342364352"
  4430. * // [1] => string(6) "253002"
  4431. * // }
  4432. * </pre>
  4433. */
  4434. public function time()
  4435. {
  4436. }
  4437. /**
  4438. * Scan the keyspace for keys
  4439. *
  4440. * @param int $iterator Iterator, initialized to NULL.
  4441. * @param string $pattern Pattern to match.
  4442. * @param int $count Count of keys per iteration (only a suggestion to Redis).
  4443. *
  4444. * @return array|bool This function will return an array of keys or FALSE if there are no more keys.
  4445. *
  4446. * @link https://redis.io/commands/scan
  4447. * @example
  4448. * <pre>
  4449. * $iterator = null;
  4450. * while(false !== ($keys = $redis->scan($iterator))) {
  4451. * foreach($keys as $key) {
  4452. * echo $key . PHP_EOL;
  4453. * }
  4454. * }
  4455. * </pre>
  4456. */
  4457. public function scan(&$iterator, $pattern = null, $count = 0)
  4458. {
  4459. }
  4460. /**
  4461. * Adds all the element arguments to the HyperLogLog data structure stored at the key.
  4462. *
  4463. * @param string $key
  4464. * @param array $elements
  4465. *
  4466. * @return bool
  4467. *
  4468. * @link https://redis.io/commands/pfadd
  4469. * @example $redis->pfAdd('key', array('elem1', 'elem2'))
  4470. */
  4471. public function pfAdd($key, array $elements)
  4472. {
  4473. }
  4474. /**
  4475. * When called with a single key, returns the approximated cardinality computed by the HyperLogLog data
  4476. * structure stored at the specified variable, which is 0 if the variable does not exist.
  4477. *
  4478. * @param string|array $key
  4479. *
  4480. * @return int
  4481. *
  4482. * @link https://redis.io/commands/pfcount
  4483. * @example
  4484. * <pre>
  4485. * $redis->pfAdd('key1', array('elem1', 'elem2'));
  4486. * $redis->pfAdd('key2', array('elem3', 'elem2'));
  4487. * $redis->pfCount('key1'); // int(2)
  4488. * $redis->pfCount(array('key1', 'key2')); // int(3)
  4489. */
  4490. public function pfCount($key)
  4491. {
  4492. }
  4493. /**
  4494. * Merge multiple HyperLogLog values into an unique value that will approximate the cardinality
  4495. * of the union of the observed Sets of the source HyperLogLog structures.
  4496. *
  4497. * @param string $destKey
  4498. * @param array $sourceKeys
  4499. *
  4500. * @return bool
  4501. *
  4502. * @link https://redis.io/commands/pfmerge
  4503. * @example
  4504. * <pre>
  4505. * $redis->pfAdd('key1', array('elem1', 'elem2'));
  4506. * $redis->pfAdd('key2', array('elem3', 'elem2'));
  4507. * $redis->pfMerge('key3', array('key1', 'key2'));
  4508. * $redis->pfCount('key3'); // int(3)
  4509. */
  4510. public function pfMerge($destKey, array $sourceKeys)
  4511. {
  4512. }
  4513. /**
  4514. * Send arbitrary things to the redis server.
  4515. *
  4516. * @param string $command Required command to send to the server.
  4517. * @param mixed $arguments Optional variable amount of arguments to send to the server.
  4518. *
  4519. * @return mixed
  4520. *
  4521. * @example
  4522. * <pre>
  4523. * $redis->rawCommand('SET', 'key', 'value'); // bool(true)
  4524. * $redis->rawCommand('GET", 'key'); // string(5) "value"
  4525. * </pre>
  4526. */
  4527. public function rawCommand($command, $arguments)
  4528. {
  4529. }
  4530. /**
  4531. * Detect whether we're in ATOMIC/MULTI/PIPELINE mode.
  4532. *
  4533. * @return int Either Redis::ATOMIC, Redis::MULTI or Redis::PIPELINE
  4534. *
  4535. * @example $redis->getMode();
  4536. */
  4537. public function getMode()
  4538. {
  4539. }
  4540. /**
  4541. * Acknowledge one or more messages on behalf of a consumer group.
  4542. *
  4543. * @param string $stream
  4544. * @param string $group
  4545. * @param array $messages
  4546. *
  4547. * @return int The number of messages Redis reports as acknowledged.
  4548. *
  4549. * @link https://redis.io/commands/xack
  4550. * @example
  4551. * <pre>
  4552. * $redis->xAck('stream', 'group1', ['1530063064286-0', '1530063064286-1']);
  4553. * </pre>
  4554. */
  4555. public function xAck($stream, $group, $messages)
  4556. {
  4557. }
  4558. /**
  4559. * Add a message to a stream
  4560. *
  4561. * @param string $key
  4562. * @param string $id
  4563. * @param array $messages
  4564. * @param int $maxLen
  4565. * @param bool $isApproximate
  4566. *
  4567. * @return string The added message ID.
  4568. *
  4569. * @link https://redis.io/commands/xadd
  4570. * @example
  4571. * <pre>
  4572. * $redis->xAdd('mystream', "*", ['field' => 'value']);
  4573. * $redis->xAdd('mystream', "*", ['field' => 'value'], 10);
  4574. * $redis->xAdd('mystream', "*", ['field' => 'value'], 10, true);
  4575. * </pre>
  4576. */
  4577. public function xAdd($key, $id, $messages, $maxLen = 0, $isApproximate = false)
  4578. {
  4579. }
  4580. /**
  4581. * Claim ownership of one or more pending messages
  4582. *
  4583. * @param string $key
  4584. * @param string $group
  4585. * @param string $consumer
  4586. * @param int $minIdleTime
  4587. * @param array $ids
  4588. * @param array $options ['IDLE' => $value, 'TIME' => $value, 'RETRYCOUNT' => $value, 'FORCE', 'JUSTID']
  4589. *
  4590. * @return array Either an array of message IDs along with corresponding data, or just an array of IDs
  4591. * (if the 'JUSTID' option was passed).
  4592. *
  4593. * @link https://redis.io/commands/xclaim
  4594. * @example
  4595. * <pre>
  4596. * $ids = ['1530113681011-0', '1530113681011-1', '1530113681011-2'];
  4597. *
  4598. * // Without any options
  4599. * $redis->xClaim('mystream', 'group1', 'myconsumer1', 0, $ids);
  4600. *
  4601. * // With options
  4602. * $redis->xClaim(
  4603. * 'mystream', 'group1', 'myconsumer2', 0, $ids,
  4604. * [
  4605. * 'IDLE' => time() * 1000,
  4606. * 'RETRYCOUNT' => 5,
  4607. * 'FORCE',
  4608. * 'JUSTID'
  4609. * ]
  4610. * );
  4611. * </pre>
  4612. */
  4613. public function xClaim($key, $group, $consumer, $minIdleTime, $ids, $options = [])
  4614. {
  4615. }
  4616. /**
  4617. * Delete one or more messages from a stream
  4618. *
  4619. * @param string $key
  4620. * @param array $ids
  4621. *
  4622. * @return int The number of messages removed
  4623. *
  4624. * @link https://redis.io/commands/xdel
  4625. * @example
  4626. * <pre>
  4627. * $redis->xDel('mystream', ['1530115304877-0', '1530115305731-0']);
  4628. * </pre>
  4629. */
  4630. public function xDel($key, $ids)
  4631. {
  4632. }
  4633. /**
  4634. * @param string $operation e.g.: 'HELP', 'SETID', 'DELGROUP', 'CREATE', 'DELCONSUMER'
  4635. * @param string $key
  4636. * @param string $group
  4637. * @param string $msgId
  4638. * @param bool $mkStream
  4639. *
  4640. * @return mixed This command returns different types depending on the specific XGROUP command executed.
  4641. *
  4642. * @link https://redis.io/commands/xgroup
  4643. * @example
  4644. * <pre>
  4645. * $redis->xGroup('CREATE', 'mystream', 'mygroup', 0);
  4646. * $redis->xGroup('CREATE', 'mystream', 'mygroup', 0, true); // create stream
  4647. * $redis->xGroup('DESTROY', 'mystream', 'mygroup');
  4648. * </pre>
  4649. */
  4650. public function xGroup($operation, $key, $group, $msgId = '', $mkStream = false)
  4651. {
  4652. }
  4653. /**
  4654. * Get information about a stream or consumer groups
  4655. *
  4656. * @param string $operation e.g.: 'CONSUMERS', 'GROUPS', 'STREAM', 'HELP'
  4657. * @param string $stream
  4658. * @param string $group
  4659. *
  4660. * @return mixed This command returns different types depending on which subcommand is used.
  4661. *
  4662. * @link https://redis.io/commands/xinfo
  4663. * @example
  4664. * <pre>
  4665. * $redis->xInfo('STREAM', 'mystream');
  4666. * </pre>
  4667. */
  4668. public function xInfo($operation, $stream, $group)
  4669. {
  4670. }
  4671. /**
  4672. * Get the length of a given stream.
  4673. *
  4674. * @param string $stream
  4675. *
  4676. * @return int The number of messages in the stream.
  4677. *
  4678. * @link https://redis.io/commands/xlen
  4679. * @example
  4680. * <pre>
  4681. * $redis->xLen('mystream');
  4682. * </pre>
  4683. */
  4684. public function xLen($stream)
  4685. {
  4686. }
  4687. /**
  4688. * Get information about pending messages in a given stream
  4689. *
  4690. * @param string $stream
  4691. * @param string $group
  4692. * @param string $start
  4693. * @param string $end
  4694. * @param int $count
  4695. * @param string $consumer
  4696. *
  4697. * @return array Information about the pending messages, in various forms depending on
  4698. * the specific invocation of XPENDING.
  4699. *
  4700. * @link https://redis.io/commands/xpending
  4701. * @example
  4702. * <pre>
  4703. * $redis->xPending('mystream', 'mygroup');
  4704. * $redis->xPending('mystream', 'mygroup', '-', '+', 1, 'consumer-1');
  4705. * </pre>
  4706. */
  4707. public function xPending($stream, $group, $start = null, $end = null, $count = null, $consumer = null)
  4708. {
  4709. }
  4710. /**
  4711. * Get a range of messages from a given stream
  4712. *
  4713. * @param string $stream
  4714. * @param string $start
  4715. * @param string $end
  4716. * @param int $count
  4717. *
  4718. * @return array The messages in the stream within the requested range.
  4719. *
  4720. * @link https://redis.io/commands/xrange
  4721. * @example
  4722. * <pre>
  4723. * // Get everything in this stream
  4724. * $redis->xRange('mystream', '-', '+');
  4725. * // Only the first two messages
  4726. * $redis->xRange('mystream', '-', '+', 2);
  4727. * </pre>
  4728. */
  4729. public function xRange($stream, $start, $end, $count = null)
  4730. {
  4731. }
  4732. /**
  4733. * Read data from one or more streams and only return IDs greater than sent in the command.
  4734. *
  4735. * @param array $streams
  4736. * @param int|string $count
  4737. * @param int|string $block
  4738. *
  4739. * @return array The messages in the stream newer than the IDs passed to Redis (if any)
  4740. *
  4741. * @link https://redis.io/commands/xread
  4742. * @example
  4743. * <pre>
  4744. * $redis->xRead(['stream1' => '1535222584555-0', 'stream2' => '1535222584555-0']);
  4745. * </pre>
  4746. */
  4747. public function xRead($streams, $count = null, $block = null)
  4748. {
  4749. }
  4750. /**
  4751. * This method is similar to xRead except that it supports reading messages for a specific consumer group.
  4752. *
  4753. * @param string $group
  4754. * @param string $consumer
  4755. * @param array $streams
  4756. * @param int|null $count
  4757. * @param int|null $block
  4758. *
  4759. * @return array The messages delivered to this consumer group (if any).
  4760. *
  4761. * @link https://redis.io/commands/xreadgroup
  4762. * @example
  4763. * <pre>
  4764. * // Consume messages for 'mygroup', 'consumer1'
  4765. * $redis->xReadGroup('mygroup', 'consumer1', ['s1' => 0, 's2' => 0]);
  4766. * // Read a single message as 'consumer2' for up to a second until a message arrives.
  4767. * $redis->xReadGroup('mygroup', 'consumer2', ['s1' => 0, 's2' => 0], 1, 1000);
  4768. * </pre>
  4769. */
  4770. public function xReadGroup($group, $consumer, $streams, $count = null, $block = null)
  4771. {
  4772. }
  4773. /**
  4774. * This is identical to xRange except the results come back in reverse order.
  4775. * Also note that Redis reverses the order of "start" and "end".
  4776. *
  4777. * @param string $stream
  4778. * @param string $end
  4779. * @param string $start
  4780. * @param int $count
  4781. *
  4782. * @return array The messages in the range specified
  4783. *
  4784. * @link https://redis.io/commands/xrevrange
  4785. * @example
  4786. * <pre>
  4787. * $redis->xRevRange('mystream', '+', '-');
  4788. * </pre>
  4789. */
  4790. public function xRevRange($stream, $end, $start, $count = null)
  4791. {
  4792. }
  4793. /**
  4794. * Trim the stream length to a given maximum.
  4795. * If the "approximate" flag is pasesed, Redis will use your size as a hint but only trim trees in whole nodes
  4796. * (this is more efficient)
  4797. *
  4798. * @param string $stream
  4799. * @param int $maxLen
  4800. * @param bool $isApproximate
  4801. *
  4802. * @return int The number of messages trimed from the stream.
  4803. *
  4804. * @link https://redis.io/commands/xtrim
  4805. * @example
  4806. * <pre>
  4807. * // Trim to exactly 100 messages
  4808. * $redis->xTrim('mystream', 100);
  4809. * // Let Redis approximate the trimming
  4810. * $redis->xTrim('mystream', 100, true);
  4811. * </pre>
  4812. */
  4813. public function xTrim($stream, $maxLen, $isApproximate)
  4814. {
  4815. }
  4816. /**
  4817. * Adds a values to the set value stored at key.
  4818. *
  4819. * @param string $key Required key
  4820. * @param array $values Required values
  4821. *
  4822. * @return int|bool The number of elements added to the set.
  4823. * If this value is already in the set, FALSE is returned
  4824. *
  4825. * @link https://redis.io/commands/sadd
  4826. * @link https://github.com/phpredis/phpredis/commit/3491b188e0022f75b938738f7542603c7aae9077
  4827. * @since phpredis 2.2.8
  4828. * @example
  4829. * <pre>
  4830. * $redis->sAddArray('k', array('v1')); // boolean
  4831. * $redis->sAddArray('k', array('v1', 'v2', 'v3')); // boolean
  4832. * </pre>
  4833. */
  4834. public function sAddArray($key, array $values)
  4835. {
  4836. }
  4837. }
  4838. class RedisException extends Exception
  4839. {
  4840. }
  4841. /**
  4842. * @mixin \Redis
  4843. */
  4844. class RedisArray
  4845. {
  4846. /**
  4847. * Constructor
  4848. *
  4849. * @param string|array $hosts Name of the redis array from redis.ini or array of hosts to construct the array with
  4850. * @param array $opts Array of options
  4851. *
  4852. * @link https://github.com/nicolasff/phpredis/blob/master/arrays.markdown
  4853. */
  4854. public function __construct($hosts, array $opts = null)
  4855. {
  4856. }
  4857. /**
  4858. * @return array list of hosts for the selected array
  4859. */
  4860. public function _hosts()
  4861. {
  4862. }
  4863. /**
  4864. * @return string the name of the function used to extract key parts during consistent hashing
  4865. */
  4866. public function _function()
  4867. {
  4868. }
  4869. /**
  4870. * @param string $key The key for which you want to lookup the host
  4871. *
  4872. * @return string the host to be used for a certain key
  4873. */
  4874. public function _target($key)
  4875. {
  4876. }
  4877. /**
  4878. * Use this function when a new node is added and keys need to be rehashed.
  4879. */
  4880. public function _rehash()
  4881. {
  4882. }
  4883. /**
  4884. * Returns an associative array of strings and integers, with the following keys:
  4885. * - redis_version
  4886. * - redis_git_sha1
  4887. * - redis_git_dirty
  4888. * - redis_build_id
  4889. * - redis_mode
  4890. * - os
  4891. * - arch_bits
  4892. * - multiplexing_api
  4893. * - atomicvar_api
  4894. * - gcc_version
  4895. * - process_id
  4896. * - run_id
  4897. * - tcp_port
  4898. * - uptime_in_seconds
  4899. * - uptime_in_days
  4900. * - hz
  4901. * - lru_clock
  4902. * - executable
  4903. * - config_file
  4904. * - connected_clients
  4905. * - client_longest_output_list
  4906. * - client_biggest_input_buf
  4907. * - blocked_clients
  4908. * - used_memory
  4909. * - used_memory_human
  4910. * - used_memory_rss
  4911. * - used_memory_rss_human
  4912. * - used_memory_peak
  4913. * - used_memory_peak_human
  4914. * - used_memory_peak_perc
  4915. * - used_memory_peak
  4916. * - used_memory_overhead
  4917. * - used_memory_startup
  4918. * - used_memory_dataset
  4919. * - used_memory_dataset_perc
  4920. * - total_system_memory
  4921. * - total_system_memory_human
  4922. * - used_memory_lua
  4923. * - used_memory_lua_human
  4924. * - maxmemory
  4925. * - maxmemory_human
  4926. * - maxmemory_policy
  4927. * - mem_fragmentation_ratio
  4928. * - mem_allocator
  4929. * - active_defrag_running
  4930. * - lazyfree_pending_objects
  4931. * - mem_fragmentation_ratio
  4932. * - loading
  4933. * - rdb_changes_since_last_save
  4934. * - rdb_bgsave_in_progress
  4935. * - rdb_last_save_time
  4936. * - rdb_last_bgsave_status
  4937. * - rdb_last_bgsave_time_sec
  4938. * - rdb_current_bgsave_time_sec
  4939. * - rdb_last_cow_size
  4940. * - aof_enabled
  4941. * - aof_rewrite_in_progress
  4942. * - aof_rewrite_scheduled
  4943. * - aof_last_rewrite_time_sec
  4944. * - aof_current_rewrite_time_sec
  4945. * - aof_last_bgrewrite_status
  4946. * - aof_last_write_status
  4947. * - aof_last_cow_size
  4948. * - changes_since_last_save
  4949. * - aof_current_size
  4950. * - aof_base_size
  4951. * - aof_pending_rewrite
  4952. * - aof_buffer_length
  4953. * - aof_rewrite_buffer_length
  4954. * - aof_pending_bio_fsync
  4955. * - aof_delayed_fsync
  4956. * - loading_start_time
  4957. * - loading_total_bytes
  4958. * - loading_loaded_bytes
  4959. * - loading_loaded_perc
  4960. * - loading_eta_seconds
  4961. * - total_connections_received
  4962. * - total_commands_processed
  4963. * - instantaneous_ops_per_sec
  4964. * - total_net_input_bytes
  4965. * - total_net_output_bytes
  4966. * - instantaneous_input_kbps
  4967. * - instantaneous_output_kbps
  4968. * - rejected_connections
  4969. * - maxclients
  4970. * - sync_full
  4971. * - sync_partial_ok
  4972. * - sync_partial_err
  4973. * - expired_keys
  4974. * - evicted_keys
  4975. * - keyspace_hits
  4976. * - keyspace_misses
  4977. * - pubsub_channels
  4978. * - pubsub_patterns
  4979. * - latest_fork_usec
  4980. * - migrate_cached_sockets
  4981. * - slave_expires_tracked_keys
  4982. * - active_defrag_hits
  4983. * - active_defrag_misses
  4984. * - active_defrag_key_hits
  4985. * - active_defrag_key_misses
  4986. * - role
  4987. * - master_replid
  4988. * - master_replid2
  4989. * - master_repl_offset
  4990. * - second_repl_offset
  4991. * - repl_backlog_active
  4992. * - repl_backlog_size
  4993. * - repl_backlog_first_byte_offset
  4994. * - repl_backlog_histlen
  4995. * - master_host
  4996. * - master_port
  4997. * - master_link_status
  4998. * - master_last_io_seconds_ago
  4999. * - master_sync_in_progress
  5000. * - slave_repl_offset
  5001. * - slave_priority
  5002. * - slave_read_only
  5003. * - master_sync_left_bytes
  5004. * - master_sync_last_io_seconds_ago
  5005. * - master_link_down_since_seconds
  5006. * - connected_slaves
  5007. * - min-slaves-to-write
  5008. * - min-replicas-to-write
  5009. * - min_slaves_good_slaves
  5010. * - used_cpu_sys
  5011. * - used_cpu_user
  5012. * - used_cpu_sys_children
  5013. * - used_cpu_user_children
  5014. * - cluster_enabled
  5015. *
  5016. * @link https://redis.io/commands/info
  5017. * @return array
  5018. * @example
  5019. * <pre>
  5020. * $redis->info();
  5021. * </pre>
  5022. */
  5023. public function info() {
  5024. }
  5025. }