Commit Graph

382 Commits

Author SHA1 Message Date
michael-grunder
96374a9105 Implement DEBUG OBJECT
Addresses #342
2014-07-21 12:50:29 -07:00
Anatol Belski
cdd4557f01 fix unreferenced variable warnings 2014-07-01 16:59:41 +02:00
Anatol Belski
79efa8d791 fixes after the merge 2014-07-01 16:50:23 +02: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
Anatol Belski
3f9d0f7192 more C89 compat 2014-07-01 11:58:35 +02:00
vostok4
566d673f83 Fix comments for C89 compatibility 2014-04-09 11:21:32 +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
Remi Collet
b9a16b5ad5 revert previous, and better fix for memory corruption (STR_FREE available since 5.0) 2014-03-20 15:06:40 +01:00
Remi Collet
8805b133b9 redis.c:7022:13: warning: 'keyword' may be used uninitialized in this function (mostly to make gcc happy) 2014-03-20 13:49:26 +01:00
michael-grunder
d4b5631b81 TSRMLS_DC, not TSRMLS_CC in definition
Addresses #444
2014-03-17 07:40:42 -07: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
8f006cba2d Properly fix TRMLS_CC references :) 2014-02-26 06:59:11 -08:00
michael-grunder
e4d907c76a Pass TSRMLS_CC macro 2014-02-25 05:57:54 -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
1a89ec2ff4 Add Redis COPY and REPLACE flag support for Migrate command.
Addresses #426
2014-01-14 13:43:06 -08:00
michael-grunder
f39faf7dac Don't forget to prefix our keys. :) 2013-12-14 12:23:23 -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
vostok4
b7e8b3b64e Fix compilation errors on Win32 with VC11
This brings the W32 compilation fixes done by @char101 up to date and
allows building of php_redis.dll with VC11 on Win32 (allows for a php5.5
version).
2013-10-10 13:07:01 +02:00
Deniz Adrian
f3c0dd2b9f let setex properly handle long expire values
adjust the format string passed to redis_cmd_format_static() to
properly handle long int, in order to prevent integer overflows
resulting in negative expire times passed to redis.
2013-10-04 10:34:08 -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
18339ec05b If no valid keys are found when processing an HMGET command,
free up our command and keys pointer and simply return FALSE.

Addresses #379
2013-09-03 21:13:57 -07:00
michael-grunder
02bac74dc3 Initialize agg_op_len to zero 2013-09-01 13:24:48 -07:00
michael-grunder
5c4fe08b69 generic_z_command fixes
Use the lengths for our optional parameters, as NULL will
come through as a non null zval pointer with a zero length

Properly return the length from the redis_cmd_sstr_init function
2013-09-01 09:33:20 -07:00
michael-grunder
6e0f0d786c Rework generic_z_command to build the command in linear time
This commit changes how we build the Redis protocol string for
ZUNIONSTORE and ZINTERSTORE such that we avoid reallocating
memory for the command buffer for each new key or weight
2013-09-01 07:48:08 -07:00
michael-grunder
20a3ef42d8 Merge branch 'feature/mobli_ra_changes' into develop 2013-08-31 14:12:13 -07:00
michael-grunder
60e3ba781e Merge branch 'feature/new_set_args' into develop 2013-08-31 14:09:58 -07:00
michael-grunder
8e81c49b55 Performance increase for MGET
This commit changes the way we construct the MGET command
such that we avoid allocating and reallocating the command
string pointer for every new key that is added.

This means that MGET performance scales in a linear way rather
than exponentially.
2013-08-31 11:27:54 -07:00
michael-grunder
77b17e52ea Merge in MatMol's changes so we don't throw and then clear an
exception in the context of connect or pconnect

Addresses #361
2013-08-30 21:30:00 -07:00
michael-grunder
677c8df7c1 Merge remote-tracking branch 'matmol/dont_throw_exception_on_pconnect' into feature/matmol_connect_ex 2013-08-30 21:18:00 -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
michael-grunder
d1eddc4b87 Incorporate reflection flags from euskadi31
References #344

Merge remote-tracking branch 'euskadi31/patch-1' into feature/reflection_flags
2013-08-23 11:07:53 -07:00
Marlies Heijkoop
68605de48c Allow weights array to be null in generic_z_command (zUnion/zInter)
This way we can pass an aggregate function without having to also pass a dummy array(1,1,1..) with weights.
2013-08-12 21:37:16 +02:00
michael-grunder
8443769dc3 Merge remote-tracking branch 'mobli/develop' into feature/mobli_ra_changes
Conflicts:
	redis_array.c
	redis_array_impl.c
	redis_array_impl.h
2013-08-11 11:29:29 -07: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
Mathieu Kooiman
7e4cdb47f4 Don't throw exceptions for (p)connect calls.
When Redis::(p)connect() is called on a newly created Redis instance that will always cause an exception to be thrown. The connect code will actually try and cancel the
exception but this is problematic when you are using tools like APM (pecl.php.net/apm) which hook into the exception handler: it will already have handled it. This change simply stops the connect from throwing exceptions for that situation.
2013-07-29 14:00:36 +02:00
michael-grunder
e47e18c4b2 Create an alias for echo, called sendEcho
Addresses #345
2013-06-24 11:56:38 -07:00
Axel Etcheverry
e74e98e0d7 Add ZEND_ACC_CTOR and ZEND_ACC_DTOR for Reflection 2013-06-24 15:59:29 +02:00
michael-grunder
e9d5e21980 Support for '-inf', 'inf', and '+inf' for WEIGHTS
Redis allows the use of these specialized numbers in the
WEIGHTS argument for things like ZUNIONSTORE AND ZINTERSTORE
2013-05-09 11:03:43 -07:00
michael-grunder
4080dd9d0b Fix comment format 2013-04-28 11:39:34 -07:00
michael-grunder
3e6d5b60d6 Cutting a release for 2.2.3. Added myself as a maintainer
in the header files
2013-04-28 11:09:58 -07:00
michael-grunder
578bdf08cd Merge branch 'hotfix/tsrmls_cc' into develop 2013-03-28 07:58:47 -07:00
michael-grunder
411100da9e Don't duplicate TSRMLS_CC 2013-03-28 07:56:54 -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