1
0

redis.php 155 KB

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