Skip to content

Commit c32a1e0

Browse files
author
Max Kamashev
committed
add few commands
1 parent 8119d66 commit c32a1e0

File tree

1 file changed

+174
-7
lines changed

1 file changed

+174
-7
lines changed

redisphp.php

Lines changed: 174 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ public function lSize($key) {}
521521
public function lIndex($key, $index) {}
522522

523523
/**
524-
* @see lIndex
524+
* @see lIndex()
525525
*/
526526
public function lGet($key, $index) {}
527527

@@ -561,7 +561,7 @@ public function lSet($key, $index, $value) {}
561561
public function lRange($key, $start, $end) {}
562562

563563
/**
564-
* @see lRange
564+
* @see lRange()
565565
*/
566566
public function lGetRange($key, $start, $end) {}
567567

@@ -585,7 +585,7 @@ public function lGetRange($key, $start, $end) {}
585585
public function lTrim($key, $start, $stop) {}
586586

587587
/**
588-
* @see lTrim
588+
* @see lTrim()
589589
*/
590590
public function listTrim($key, $start, $stop) {}
591591

@@ -677,7 +677,7 @@ public function sAdd($key, $value) {}
677677
public function sRem($key, $member) {}
678678

679679
/**
680-
* @see sRem
680+
* @see sRem()
681681
*/
682682
public function sRemove($key, $member) {}
683683

@@ -719,7 +719,7 @@ public function sMove($srcKey, $dstKey, $member) {}
719719
public function sIsMember($key, $value) {}
720720

721721
/**
722-
* @see sIsMember
722+
* @see sIsMember()
723723
*/
724724
public function sContains($key, $value) {}
725725

@@ -901,23 +901,190 @@ public function sUnion($key1, $key2, $keyN) {}
901901
*/
902902
public function sUnionStore($dstKey, $key1, $key2, $keyN) {}
903903

904+
/**
905+
* Performs the difference between N sets and returns it.
906+
*
907+
* @param string $key1 Any number of keys corresponding to sets in redis.
908+
* @param string $key2 ...
909+
* @param string $keyN ...
910+
* @return Array of strings: The difference of the first set will all the others.
911+
* @example
912+
* $redis->delete('s0', 's1', 's2');
913+
*
914+
* $redis->sAdd('s0', '1');
915+
* $redis->sAdd('s0', '2');
916+
* $redis->sAdd('s0', '3');
917+
* $redis->sAdd('s0', '4');
918+
*
919+
* $redis->sAdd('s1', '1');
920+
* $redis->sAdd('s2', '3');
921+
*
922+
* var_dump($redis->sDiff('s0', 's1', 's2'));
923+
*
924+
* //array(2) {
925+
* // [0]=>
926+
* // string(1) "4"
927+
* // [1]=>
928+
* // string(1) "2"
929+
* //}
930+
*/
931+
public function sDiff($key1, $key2, $keyN) {}
904932

933+
/**
934+
* Performs the same action as sDiff, but stores the result in the first key
935+
*
936+
* @param string $dstKey the key to store the diff into.
937+
* @param string $key1 Any number of keys corresponding to sets in redis
938+
* @param string $key2 ...
939+
* @param string $keyN ...
940+
* @return INTEGER: The cardinality of the resulting set, or FALSE in case of a missing key.
941+
* @example
942+
* $redis->delete('s0', 's1', 's2');
943+
*
944+
* $redis->sAdd('s0', '1');
945+
* $redis->sAdd('s0', '2');
946+
* $redis->sAdd('s0', '3');
947+
* $redis->sAdd('s0', '4');
948+
*
949+
* $redis->sAdd('s1', '1');
950+
* $redis->sAdd('s2', '3');
951+
*
952+
* var_dump($redis->sDiffStore('dst', 's0', 's1', 's2'));
953+
* var_dump($redis->sMembers('dst'));
954+
*
955+
* //int(2)
956+
* //array(2) {
957+
* // [0]=>
958+
* // string(1) "4"
959+
* // [1]=>
960+
* // string(1) "2"
961+
* //}
962+
*/
963+
public function sDiffStore($dstKey, $key1, $key2, $keyN) {}
905964

965+
/**
966+
* Returns the contents of a set.
967+
*
968+
* @param type $key
969+
* @return An array of elements, the contents of the set.
970+
* @example
971+
* $redis->delete('s');
972+
* $redis->sAdd('s', 'a');
973+
* $redis->sAdd('s', 'b');
974+
* $redis->sAdd('s', 'a');
975+
* $redis->sAdd('s', 'c');
976+
* var_dump($redis->sMembers('s'));
977+
*
978+
* //array(3) {
979+
* // [0]=>
980+
* // string(1) "c"
981+
* // [1]=>
982+
* // string(1) "a"
983+
* // [2]=>
984+
* // string(1) "b"
985+
* //}
986+
* // The order is random and corresponds to redis' own internal representation of the set structure.
987+
*/
988+
public function sMembers($key) {}
906989

990+
/**
991+
* @see sMembers()
992+
*/
993+
public function sGetMembers($key) {}
907994

995+
/**
996+
* Sets a value and returns the previous entry at that key.
997+
*
998+
* @param string $key
999+
* @param string $value
1000+
* @return A string, the previous value located at this key.
1001+
* @example
1002+
* $redis->set('x', '42');
1003+
* $exValue = $redis->getSet('x', 'lol'); // return '42', replaces x by 'lol'
1004+
* $newValue = $redis->get('x')' // return 'lol'
1005+
*/
1006+
public function getSet($key, $value) {}
9081007

1008+
/**
1009+
* Returns a random key.
1010+
*
1011+
* @return STRING: an existing key in redis.
1012+
* @example
1013+
* $key = $redis->randomKey();
1014+
* $surprise = $redis->get($key); // who knows what's in there.
1015+
*/
1016+
public function randomKey() {}
9091017

9101018

1019+
/**
1020+
* Switches to a given database.
1021+
*
1022+
* @param int $dbindex
1023+
* @return TRUE in case of success, FALSE in case of failure.
1024+
* @example
1025+
* $redis->select(0); // switch to DB 0
1026+
* $redis->set('x', '42'); // write 42 to x
1027+
* $redis->move('x', 1); // move to DB 1
1028+
* $redis->select(1); // switch to DB 1
1029+
* $redis->get('x'); // will return 42
1030+
*/
1031+
public function select($dbindex) {}
9111032

1033+
/**
1034+
* Moves a key to a different database.
1035+
*
1036+
* @param string $key
1037+
* @param int $dbindex
1038+
* @return BOOL: TRUE in case of success, FALSE in case of failure.
1039+
* @example
1040+
* $redis->select(0); // switch to DB 0
1041+
* $redis->set('x', '42'); // write 42 to x
1042+
* $redis->move('x', 1); // move to DB 1
1043+
* $redis->select(1); // switch to DB 1
1044+
* $redis->get('x'); // will return 42
1045+
*/
1046+
public function move($key, $dbindex) {}
9121047

1048+
/**
1049+
* Renames a key.
1050+
*
1051+
* @param string $srcKey
1052+
* @param string $dstKey
1053+
* @return BOOL: TRUE in case of success, FALSE in case of failure.
1054+
* @example
1055+
* $redis->set('x', '42');
1056+
* $redis->rename('x', 'y');
1057+
* $redis->get('y'); // → 42
1058+
* $redis->get('x'); // → `FALSE`
1059+
*/
1060+
public function rename($srcKey, $dstKey) {}
9131061

1062+
/**
1063+
* @see rename()
1064+
*/
1065+
public function renameKey($srcKey, $dstKey) {}
9141066

1067+
/**
1068+
* Renames a key.
1069+
*
1070+
* Same as rename, but will not replace a key if the destination already exists.
1071+
* This is the same behaviour as setNx.
1072+
*
1073+
* @param string $srcKey
1074+
* @param string $dstKey
1075+
* @return BOOL: TRUE in case of success, FALSE in case of failure.
1076+
* @example
1077+
* $redis->set('x', '42');
1078+
* $redis->rename('x', 'y');
1079+
* $redis->get('y'); // → 42
1080+
* $redis->get('x'); // → `FALSE`
1081+
*/
1082+
public function renameNx($srcKey, $dstKey) {}
9151083

9161084

9171085

9181086

9191087

9201088

9211089

922-
923-
}
1090+
}

0 commit comments

Comments
 (0)