Skip to content

Commit e207e07

Browse files
author
Max Kamashev
committed
add few commands
1 parent 29ccae0 commit e207e07

File tree

1 file changed

+178
-25
lines changed

1 file changed

+178
-25
lines changed

redisphp.php

Lines changed: 178 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ public function renameKey($srcKey, $dstKey) {}
10661066

10671067
/**
10681068
* Renames a key.
1069-
*
1069+
*
10701070
* Same as rename, but will not replace a key if the destination already exists.
10711071
* This is the same behaviour as setNx.
10721072
*
@@ -1080,7 +1080,7 @@ public function renameKey($srcKey, $dstKey) {}
10801080
* $redis->get('x'); // → `FALSE`
10811081
*/
10821082
public function renameNx($srcKey, $dstKey) {}
1083-
1083+
10841084
/**
10851085
* Sets an expiration date (a timeout) on an item.
10861086
* @param string $key The key that will disappear.
@@ -1093,12 +1093,12 @@ public function renameNx($srcKey, $dstKey) {}
10931093
* $redis->get('x'); // will return `FALSE`, as 'x' has expired.
10941094
*/
10951095
public function setTimeout($key, $ttl) {}
1096-
1096+
10971097
/**
10981098
* @see setTimeout()
10991099
*/
11001100
public function expire($key, $ttl) {}
1101-
1101+
11021102
/**
11031103
* Sets an expiration date (a timestamp) on an item.
11041104
* @param strin $key The key that will disappear.
@@ -1112,7 +1112,7 @@ public function expire($key, $ttl) {}
11121112
* $redis->get('x'); // will return `FALSE`, as 'x' has expired.
11131113
*/
11141114
public function expireAt($key, $timestamp) {}
1115-
1115+
11161116
/**
11171117
* Returns the keys that match a certain pattern.
11181118
* @param string $pattern pattern, using '*' as a wildcard.
@@ -1122,7 +1122,7 @@ public function expireAt($key, $timestamp) {}
11221122
* $keyWithUserPrefix = $redis->keys('user*');
11231123
*/
11241124
public function keys($pattern) {}
1125-
1125+
11261126
/**
11271127
* @see keys()
11281128
*/
@@ -1136,25 +1136,25 @@ public function getKeys($pattern) {}
11361136
* echo "Redis has $count keys\n";
11371137
*/
11381138
public function dbSize() {}
1139-
1139+
11401140
/**
1141-
* Authenticate the connection using a password.
1141+
* Authenticate the connection using a password.
11421142
* Warning: The password is sent in plain-text over the network.
11431143
* @param string $password
11441144
* @return BOOL: TRUE if the connection is authenticated, FALSE otherwise.
11451145
* @example
11461146
* $redis->auth('foobared');
11471147
*/
11481148
public function auth($password) {}
1149-
1149+
11501150
/**
11511151
* Starts the background rewrite of AOF (Append-Only File)
11521152
* @return BOOL: TRUE in case of success, FALSE in case of failure.
11531153
* @example
11541154
* $redis->bgrewriteaof();
11551155
*/
11561156
public function bgrewriteaof() {}
1157-
1157+
11581158
/**
11591159
* Changes the slave status
11601160
* Either host and port, or no parameter to stop being a slave.
@@ -1163,19 +1163,19 @@ public function bgrewriteaof() {}
11631163
* @return BOOL: TRUE in case of success, FALSE in case of failure.
11641164
* @example
11651165
* $redis->slaveof('10.0.1.7', 6379);
1166-
* // ...
1166+
* // ...
11671167
* $redis->slaveof();
11681168
*/
11691169
public function slaveof($host = '', $port = '') {}
1170-
1170+
11711171
/**
11721172
* Describes the object pointed to by a key.
1173-
* The information to retrieve (string) and the key (string).
1173+
* The information to retrieve (string) and the key (string).
11741174
* Info can be one of the following:
11751175
* - "encoding"
11761176
* - "refcount"
11771177
* - "idletime"
1178-
*
1178+
*
11791179
* @param string $string
11801180
* @param string $key
11811181
* @return STRING for "encoding", LONG for "refcount" and "idletime", FALSE if the key doesn't exist.
@@ -1185,53 +1185,53 @@ public function slaveof($host = '', $port = '') {}
11851185
* $redis->object("idletime", "l"); // → 400 (in seconds, with a precision of 10 seconds).
11861186
*/
11871187
public function object($string = '', $key = '') {}
1188-
1188+
11891189
/**
11901190
* Performs a synchronous save.
1191-
* @return BOOL: TRUE in case of success, FALSE in case of failure.
1191+
* @return BOOL: TRUE in case of success, FALSE in case of failure.
11921192
* If a save is already running, this command will fail and return FALSE.
11931193
* @example
11941194
* $redis->save();
11951195
*/
11961196
public function save() {}
1197-
1197+
11981198
/**
11991199
* Performs a background save.
1200-
* @return BOOL: TRUE in case of success, FALSE in case of failure.
1200+
* @return BOOL: TRUE in case of success, FALSE in case of failure.
12011201
* If a save is already running, this command will fail and return FALSE.
12021202
* @example
12031203
* $redis->bgSave();
12041204
*/
12051205
public function bgsave() {}
1206-
1206+
12071207
/**
12081208
* Returns the timestamp of the last disk save.
12091209
* @return INT: timestamp.
12101210
* @example
12111211
* $redis->lastSave();
12121212
*/
12131213
public function lastSave() {}
1214-
1215-
1214+
1215+
12161216
/**
12171217
* Returns the type of data pointed by a given key.
12181218
* @param string $key
1219-
* @return Depending on the type of the data pointed by the key,
1219+
* @return Depending on the type of the data pointed by the key,
12201220
* this method will return the following value:
12211221
* - string: Redis::REDIS_STRING
12221222
* - set: Redis::REDIS_SET
12231223
* - list: Redis::REDIS_LIST
12241224
* - zset: Redis::REDIS_ZSET
12251225
* - hash: Redis::REDIS_HASH
1226-
* - other: Redis::REDIS_NOT_FOUND
1226+
* - other: Redis::REDIS_NOT_FOUND
12271227
* @example
12281228
* $redis->type('key');
12291229
*/
12301230
public function type($key) {}
1231-
1231+
12321232
/**
12331233
* Append specified string to the string stored in specified key.
1234-
* @param string $key
1234+
* @param string $key
12351235
* @param string $value
12361236
* @return INTEGER: Size of the value after the append
12371237
* @example
@@ -1242,6 +1242,159 @@ public function type($key) {}
12421242
public function append() {}
12431243

12441244

1245+
/**
1246+
* Return a substring of a larger string
1247+
* @param string $key
1248+
* @param int $start
1249+
* @param int $end
1250+
* @return STRING: the substring
1251+
* @example
1252+
* $redis->set('key', 'string value');
1253+
* $redis->getRange('key', 0, 5); // 'string'
1254+
* $redis->getRange('key', -5, -1); // 'value'
1255+
*/
1256+
public function getRange($key, $start, $end) {}
1257+
1258+
/**
1259+
* Return a substring of a larger string
1260+
* @deprecated
1261+
* @param type $key
1262+
* @param type $start
1263+
* @param type $end
1264+
*/
1265+
public function substr($key, $start, $end) {}
1266+
1267+
1268+
/**
1269+
* Changes a substring of a larger string.
1270+
* @param string $key
1271+
* @param int $offset
1272+
* @param string $value
1273+
* @return STRING: the length of the string after it was modified.
1274+
* @example
1275+
* $redis->set('key', 'Hello world');
1276+
* $redis->setRange('key', 6, "redis"); // returns 11
1277+
* $redis->get('key'); // "Hello redis"
1278+
*/
1279+
public function setRange($key, $offset, $value) {}
1280+
1281+
/**
1282+
* Get the length of a string value.
1283+
* @param type $key
1284+
* @return INTEGER
1285+
* @example
1286+
* $redis->set('key', 'value');
1287+
* $redis->strlen('key'); // 5
1288+
*/
1289+
public function strlen($key) {}
1290+
1291+
/**
1292+
* Return a single bit out of a larger string
1293+
* @param string $key
1294+
* @param int $offset
1295+
* @return LONG: the bit value (0 or 1)
1296+
* @example
1297+
* $redis->set('key', "\x7f"); // this is 0111 1111
1298+
* $redis->getBit('key', 0); // 0
1299+
* $redis->getBit('key', 1); // 1
1300+
*/
1301+
public function getBit($key, $offset) {}
1302+
1303+
/**
1304+
* Changes a single bit of a string.
1305+
* @param string $key
1306+
* @param int $offset
1307+
* @param bool||int $value bool or int (1 or 0)
1308+
* @return LONG: 0 or 1, the value of the bit before it was set.
1309+
* @example
1310+
* $redis->set('key', "*"); // ord("*") = 42 = 0x2f = "0010 1010"
1311+
* $redis->setBit('key', 5, 1); // returns 0
1312+
* $redis->setBit('key', 7, 1); // returns 0
1313+
* $redis->get('key'); // chr(0x2f) = "/" = b("0010 1111")
1314+
*/
1315+
public function setBit($key, $offset, $value) {}
1316+
1317+
1318+
/**
1319+
* Removes all entries from the current database.
1320+
* @return BOOL: Always TRUE.
1321+
* @example $redis->flushDB();
1322+
*/
1323+
public function flushDB() {}
1324+
1325+
/**
1326+
* Removes all entries from all databases.
1327+
* @return BOOL: Always TRUE.
1328+
* @example $redis->flushAll();
1329+
*/
1330+
public function flushAll() {}
1331+
1332+
1333+
1334+
/**
1335+
* Sort
1336+
* @param string $key
1337+
* @param array $option array(key => value, ...) - optional, with the following keys and values:
1338+
* - 'by' => 'some_pattern_*',
1339+
* - 'limit' => array(0, 1),
1340+
* - 'get' => 'some_other_pattern_*' or an array of patterns,
1341+
* - 'sort' => 'asc' or 'desc',
1342+
* - 'alpha' => TRUE,
1343+
* - 'store' => 'external-key'
1344+
* @return
1345+
* An array of values, or a number corresponding to the number of elements stored if that was used.
1346+
* @example
1347+
* $redis->delete('s');
1348+
* $redis->sadd('s', 5);
1349+
* $redis->sadd('s', 4);
1350+
* $redis->sadd('s', 2);
1351+
* $redis->sadd('s', 1);
1352+
* $redis->sadd('s', 3);
1353+
*
1354+
* var_dump($redis->sort('s')); // 1,2,3,4,5
1355+
* var_dump($redis->sort('s', array('sort' => 'desc'))); // 5,4,3,2,1
1356+
* var_dump($redis->sort('s', array('sort' => 'desc', 'store' => 'out'))); // (int)5
1357+
*/
1358+
public function sort($key, $option = null) {}
1359+
1360+
1361+
/**
1362+
* Returns an associative array of strings and integers, with the following keys:
1363+
* - redis_version
1364+
* - arch_bits
1365+
* - uptime_in_seconds
1366+
* - uptime_in_days
1367+
* - connected_clients
1368+
* - connected_slaves
1369+
* - used_memory
1370+
* - changes_since_last_save
1371+
* - bgsave_in_progress
1372+
* - last_save_time
1373+
* - total_connections_received
1374+
* - total_commands_processed
1375+
* - role
1376+
* @example $redis->info();
1377+
*/
1378+
public function info() {}
1379+
1380+
/**
1381+
* Returns the time to live left for a given key, in seconds. If the key doesn't exist, FALSE is returned.
1382+
* @param string $key
1383+
* @return Long, the time left to live in seconds.
1384+
* @example $redis->ttl('key');
1385+
*/
1386+
public function ttl($key) {}
1387+
1388+
/**
1389+
* Remove the expiration timer from a key.
1390+
* @param string $key
1391+
* @return BOOL: TRUE if a timeout was removed, FALSE if the key didn’t exist or didn’t have an expiration timer.
1392+
* @example $redis->persist('key');
1393+
*/
1394+
public function persist($key) {}
1395+
1396+
1397+
12451398

12461399

12471400

0 commit comments

Comments
 (0)