Commit Graph

213 Commits

Author SHA1 Message Date
michael-grunder
96374a9105 Implement DEBUG OBJECT
Addresses #342
2014-07-21 12:50:29 -07:00
michael-grunder
7a80c10905 Remove duplicate pubsub test 2014-07-06 10:58:22 -07:00
Anatol Belski
4d2533706a Merge remote-tracking branch 'vostok4/master'
Conflicts:
	CREDITS
	README.markdown
	config.w32
	library.c
	library.h
	package.xml
	redis.c
	redis_array.c
	redis_array.h
	redis_array_impl.c
	redis_array_impl.h
	tests/TestRedis.php
2014-07-01 16:45:09 +02:00
vostok4
9c12c40a66 Merge nicolasff:b9a16b5ad5 in, fixing for Win32
Now we should be up to master with upstream for an easier merge.
2014-04-09 11:14:45 +02:00
michael-grunder
6c37fa301d Merge branch 'feature/pubsub_cmd' into develop 2014-03-15 10:14:41 -07:00
michael-grunder
e74ffe0366 Implemented BITPOS command
This commit introduces the new BITPOS redis command
http://redis.io/commands/bitpos
2014-03-03 06:23:38 -08:00
michael-grunder
f200730fe9 _serialize method
This commit adds a utility method as a counterpart to the _unserialize
utility method, allowing users to manually serialize data themselves
before sending it to Redis.  This could be useful for calls going through
EVAL, as phpredis can't automatically serialize/unserialize in that case.

Addresses #431
2014-02-04 11:55:08 -08:00
michael-grunder
48ae8e52f6 Implement PUBSUB command
This commit implements the Redis PUBSUB command, a new command
available since Redis 2.8.0 and described here:
http://redis.io/commands/pubsub

Addresses #427
2014-01-21 14:50:34 -08:00
michael-grunder
ab553893f9 SCAN and variants
This commit introduces support for the Redis SCAN, HSCAN, SSCAN,
and ZSCAN commands.

In the case of HSCAN, SSCAN, and ZSCAN, we take a key and iterator
as required arguments, and for SCAN just an iterator.  Matching
the Redis commands, each variant can optionally take a pattern
to match against and a count value which hints at Redis how many
keys to return at a time.

When scanning keys or members (especially with a large keyspace when
searching for a pattern), Redis will sometimes return an empty result
of keys/members.  PHPRedis can be set up to abstract this from the
caller by setting:

$redis->setOption(Redis::OPT_SCAN, Redis::SCAN_RETRY);

Which instructs PHPRedis to keep retrying the scan until members are
returned OR the iteration completes (Redis returns to us a zero iterator).

By default this option is set to Redis::SCAN_NORETRY, meaning that
empty results are possible, requiring an explicit check for FALSE in the
scanning loop, like so:

```php
$it = NULL;
while(($arr_keys = $redis->scan($it, "*pattern*"))!==FALSE) {
	print_r($arr_keys);
}
```
2013-12-14 10:51:03 -08:00
michael-grunder
77afbe3dac Implement WAIT command
This commit implements the new WAIT command which currently lives
in redis unstable, along with a unit test.

Also added myself to the README.markdown file, as well as a link to
"the twitter".
2013-12-07 14:08:18 -08:00
michael-grunder
2108446ecb Don't free the key before we use it
Fixes #408
2013-11-19 07:40:02 -08:00
michael-grunder
32837e06e9 Allow for NULL to be passed in our optional arguments and just
ignore it if it is (but still set the key).

Addresses #407
2013-11-18 11:41:19 -08:00
michael-grunder
eff6a91340 Enforce offset range limitations for GETBIT and SETBIT
Addresses #401
2013-11-13 15:00:13 -08:00
michael-grunder
f3f361a427 Fix serializer support for SRANDMEMBER for both one member
and when the count argument is passed.

Addresses #391
2013-11-13 11:16:41 -08:00
Soenke Ruempler
0f003bcb2d regression test for: setex properly handles long expire values 2013-10-04 10:34:22 -07:00
michael-grunder
b144743345 Rework the HMGET command to skip invalid keys
This relates to a previous hotfix for issue #379 where phpredis
would time out if you sent an array of empty values.  The reason
it was timing out is that the argument count being sent wasn't
reflecting any skipped items in the array (meaning redis was
waiting for the rest of the command).

I realized that the previous fix would still fail if you were to
send some valid values, with invalid (null, empty string, etc)
ones mixed in.

Presently, we're just skipping invalid items in the array but there
might be a case to issue a php_error_docref type warning when we
encounter them, so the user can know that it happened.

In addition, HMGET now uses a smart_str to build the command, which
means the time it takes to build the key will scale in a linear fashion
2013-09-05 15:08:30 -07:00
michael-grunder
a0e9b65d4c Add a unit test for the scenario described in #379 2013-09-03 21:17:38 -07:00
michael-grunder
60e3ba781e Merge branch 'feature/new_set_args' into develop 2013-08-31 14:09:58 -07:00
michael-grunder
bab2a192b7 Fix an erroneous unit test failure for TTL
When using the TTL command, Redis >= 2.8 will return -1 for a key
with no TTL and -2 for a key that doesn't exist.  This fixes the
unit tests so they don't expect this in versions < 2.8.
2013-08-30 21:11:02 -07:00
michael-grunder
7207aae8aa Add SLOWLOG command
Add support for the various slowlog commands you can execute
in Redis, including:

SLOWLOG GET [len]
SLOWLOG RESET
SLOWLOG LIST
2013-08-27 21:26:51 -07:00
Marlies Heijkoop
d01abbbd7d Added tests for zUnion and zInter with aggregate functions but without weights 2013-08-12 21:36:13 +02:00
michael-grunder
711f053b9f Redis >= 2.6.12 extended set options
Implement the new SET options as per the redis documentation:
http://redis.io/commands/set

You can now pass the new options (ex=>sec, px=>milisec, xx, nx) as
an array of options to the SET command and phpredis will handle them.

If you pass key, value, <long> phpredis will still redirect to SETEX
as it did before (to avoid breaking implementations).

Addresses #364
2013-08-02 23:31:27 -07:00
michael-grunder
1b624141c0 Update documentation and unit tests for TTL/PTTL
Addresses #358
2013-07-31 14:57:26 -07:00
michael-grunder
75ddd072a4 Add unit tests for -inf/inf/+inf WEIGHTS
Addresses issue #336
2013-05-09 11:55:43 -07:00
michael-grunder
e914485313 Merge branch 'hotfix/inspection_methods' into develop
Conflicts:
	php_redis.h
	redis.c
2013-03-27 11:21:02 -07:00
michael-grunder
ef792320e7 Introspection methods
This commit adds methods to get information about the state
of our phpredis object, such as what host/port we are connected
to, our timeout, etc...

The following methods have been added:

getHost()
getPort()
getDBNum()
getTimeout()
getReadTimeout()
isConnected()
getPersistentID()
getAuth()

In addition, there is a small memory leak fix when a persistent id
was specifically passed to connect() (it wasn't beeing freed).

Addresses issue #320
2013-03-27 10:21:18 -07:00
Nicolas Favre-Felix
a4784b4de7 Merge branch 'hotfix/issue-229' into develop 2013-02-17 16:32:08 +00:00
Nicolas Favre-Felix
5953e8fe13 Merge branch 'rnamiki-master' into hotfix/issue-229 2013-02-17 16:26:18 +00:00
Nicolas Favre-Felix
fb7c7a8d2e Merge branch 'hotfix/fix-broken-delete-test' into develop 2013-02-17 16:21:20 +00:00
Nicolas Favre-Felix
8b4ee3dda2 Fix broken test with unexpected result for delete 2013-02-17 16:20:44 +00:00
Nicolas Favre-Felix
48b3e6b8c5 Merge branch 'hotfix/ttl-response-type' into develop 2013-02-17 16:18:02 +00:00
Nicolas Favre-Felix
90bdf9e8fd Fix test for TTL return value
Resolves issue #302
2013-02-17 16:17:25 +00:00
Nicolas Favre-Felix
4231d70b66 Merge branch 'master' of https://github.com/rnamiki/phpredis into rnamiki-master 2013-02-17 16:07:39 +00:00
michael-grunder
9a5196ed2e CLIENT Commands
This commit adds support for the CLIENT commands (list, getname,
setname, kill).

You can call them like so:

$redis->client('list');
$redis->client('getname');
$redis->client('setname', $name);
$redis->client('kill', $ip_port);

Solves issue #300
2013-02-16 17:57:32 -08:00
michael-grunder
55dd05356d Merge remote-tracking branch 'kotas/opt-read-timeout'
Conflicts:
	library.c
2013-02-11 12:42:49 -08:00
michael-grunder
242a16d50a Merge branch 'srandmember_count'
Conflicts:
	tests/TestRedis.php
2013-02-04 13:22:29 -08:00
michael-grunder
e1a5145ad2 Changed the way we build the HMSET command such that we don't
continue to destroy and reallocate the command buffer

Added a simply library routine to append to a command buffer
using a smart_str

Made the unit tests work even if you're not compiled with
igbinary

Addresses issue #287
2013-01-18 18:05:02 -08:00
Pepijn Verlaan
93dae810ce Added failing test for brpoplpush command 2012-11-16 09:52:37 +01:00
michael-grunder
51b96938bc SRANDMEMBER optional COUNT argument
Adds support for the new COUNT argument to SRANDMEMBER.  If called
without a count, we will still return a string response (with one
randome member from the set, or false on a failure/type error).

If the count argument is passed, we return instead an array up to
the number asked for, given how Redis will process this value.

http://redis.io/commands/srandmember
2012-10-25 14:19:04 -07:00
kotas
3764a6cd80 add Redis::OPT_READ_TIMEOUT option for issue #70 2012-10-04 22:18:18 +09:00
Nicolas Favre-Felix
7dfac44c8f Add missing serializer in zInter args
Fixes GitHub issue #252
2012-09-21 18:05:15 +01:00
Nicolas Favre-Felix
5855cfc2ca Add clearLastError 2012-09-09 22:09:27 +01:00
Nicolas Favre-Felix
6153477c4f Extend getLastError to all calls
Fixes GitHub issue #245.
2012-09-09 20:38:30 +01:00
Remi Collet
deca4fa30c add 'markTestSkipped' method to test suite, improves report 2012-09-01 09:49:11 +02:00
Remi Collet
a968d9ea79 SCRIPT / EVAL / TIME are new in 2.6.0 2012-08-31 16:20:42 +02:00
Remi Collet
36f5f76786 INFO COMMANDSTATS is new in 2.6.0 2012-08-31 16:14:35 +02:00
Remi Collet
5ee3c840cb INFO COMMANDSTATS is new in 2.6.0 2012-08-31 16:12:04 +02:00
Remi Collet
e839d248bb INCRBYFLOAT new in 2.6.0 2012-08-31 16:10:07 +02:00
Remi Collet
0ad8482727 manage test suite exit code 2012-08-31 16:05:29 +02:00
Remi Collet
2516eb22bb proposal for multi-version test suite ("All tests passed." with 2.6.0RC6) 2012-08-31 15:25:56 +02:00