Commit Graph

172 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
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
1fdefc2755 atoll vs _atoi64 2014-07-01 11:45:41 +02:00
Anatol Belski
00be281e1b C89 compat 2014-07-01 11:41:55 +02:00
Anatol Belski
792a71da73 fixed prototype 2014-07-01 11:33:23 +02:00
Anatol Belski
603b20e763 fix random() vs php_rand() for portability 2014-07-01 11:29:30 +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
d74b0d27f3 Fix warning: 'klen' may be used uninitialized in this function 2014-03-20 13:56:49 +01:00
Remi Collet
47ddcf75fd Fix ibrary.c:1541:9: warning: unused variable 'sz' + 'val8' 2014-03-20 13:56:11 +01:00
Remi Collet
7634db4283 Fix: library.c:743:78: warning: unused variable 'p2' (PLEASE CHECK) 2014-03-20 13:54:53 +01:00
Remi Collet
5520be1042 Fix memory corruption observed with PHP 5.6.0-dev 2014-03-20 13:48:04 +01:00
michael-grunder
8f006cba2d Properly fix TRMLS_CC references :) 2014-02-26 06:59:11 -08:00
michael-grunder
79ccf9aec4 Merge branch 'hotfix/eval_timeout_segfault' into develop 2014-02-20 22:26:23 -08:00
michael-grunder
d2832bfa85 We need to return immediately from our variant reply parsing
function if we get a protocol error, rather than just throwing
and exception and breaking execution of the loop.

Addresses #437
2014-02-20 15:48:15 -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
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
vostok4
978fbcf6fc Further fixes for building on VC9 Win32, C89 compliance
Include win32/php_stdint.h on Win32 (fixes compilation on VC9)
Change C++ comments to C89 style (to adhere to PHP project)
2013-10-18 14:37:06 +02: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
michael-grunder
4a6c01bc1a Send a newline with the QUIT command
Addresses #381
2013-09-07 13:51:33 -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
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
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
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
michael-grunder
b2a57c1f9f Merge branch 'hotfix/serializer_leak' into develop 2013-03-16 11:40:36 -07:00
michael-grunder
a4627bb94b Fixes a memory leak, and possible undefined behavior if we have
a serialization failure and just return the raw contents of a key.

Addresses issue #315
2013-03-15 16:34:05 -07:00
Emmanuel Merali
4f2aa60e25 Merge remote-tracking branch 'upstream/develop' into develop 2013-02-25 04:06:13 +02:00
michael-grunder
d6c29e4348 Merge branch 'hotfix/fix_return_values' into develop 2013-02-24 17:52:56 -08:00
michael-grunder
703476ce01 Fix each place we're erroring out but return a value as the
methods are int returns

Resolves issues pertaining to #303
2013-02-24 17:51:56 -08:00
michael-grunder
0816289454 Merge branch 'hotfix/add_retval_zipped_wreply' into develop 2013-02-24 16:47:57 -08:00
michael-grunder
9954974778 Return a proper value
redis_sock_read_multibulk_reply_zipped_with_flag should always return
a value.  We merged in a change that handled a certain error condition
that was using RETURN_FALSE (and therefore not returning a value)

Simply changed this to RETVAL_FALSE and return -1;
2013-02-24 16:45:11 -08:00
michael-grunder
e457d9813d Don't return a value from a void function 2013-02-24 16:32:40 -08:00
Emmanuel Merali
ec74ab98df Merge remote-tracking branch 'upstream/develop' into develop
Conflicts:
	library.c
	library.h
	redis.c
	redis_array.c
	redis_array_impl.c
	redis_array_impl.h
	redis_session.c
2013-02-25 00:54:48 +02:00
Emmanuel Merali
acd3245456 Added lazy_connect option to RedisArray
Added an option to let each RedisArray connection connect lazily to
their respective server. This is useful then working with a redis
cluster composed of many shards which are not necessarily in use all at
once.
2013-02-25 00:38:47 +02:00
Emmanuel Merali
4ae635fddf Merge remote-tracking branch 'upstream/master'
Conflicts:
	common.h
2013-02-24 23:41:12 +02:00
Emmanuel Merali
6d3c9990a5 Merged changes from @mobli
New select DB command to RedisArray - Added retry delay on reconnect

Added the possibility to delay each reconnection attempt, including a
random factor to prevent several or many concurrent connections from
trying to reconnect at the same time.
Added the select command to RedisArray to select a DB on every
connections in one instruction.
Also, fixed a compiler warning:
redis_array_impl.c:1115:15: warning: incompatible pointer types
assigning to 'zval **' (aka 'struct _zval_struct **') from 'zval
**(*)[2]' [-Wincompatible-pointer-types]

Conflicts:
	common.h
2013-02-22 09:35:22 -08:00
Nicolas Favre-Felix
a4784b4de7 Merge branch 'hotfix/issue-229' into develop 2013-02-17 16:32:08 +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
Emmanuel Merali
d4c7f64131 New select DB command to RedisArray - Added retry delay on reconnect
Added the possibility to delay each reconnection attempt, including a
random factor to prevent several or many concurrent connections from
trying to reconnect at the same time.
Added the select command to RedisArray to select a DB on every
connections in one instruction.
Also, fixed a compiler warning:
redis_array_impl.c:1115:15: warning: incompatible pointer types
assigning to 'zval **' (aka 'struct _zval_struct **') from 'zval
**(*)[2]' [-Wincompatible-pointer-types]
2013-01-29 11:47:36 +02:00
Emmanuel Merali
9ba000c54c Revert "Retry delay - selectDB on array"
This reverts commit 3fb643211e.
2013-01-29 11:40:06 +02:00
Emmanuel Merali
e0ee405fe9 Revert "New select DB command to RedisArray - Added retry delay on reconnect"
This reverts commit 6091727ba3.
2013-01-29 11:39:13 +02:00
Emmanuel Merali
6091727ba3 New select DB command to RedisArray - Added retry delay on reconnect
Added the possibility to delay each reconnection attempt, including a
random factor to prevent several or many concurrent connections from
trying to reconnect at the same time.
Added the select command to RedisArray to select a DB on every
connections in one instruction.
Also, fixed a compiler warning:
redis_array_impl.c:1115:15: warning: incompatible pointer types
assigning to 'zval **' (aka 'struct _zval_struct **') from 'zval
**(*)[2]' [-Wincompatible-pointer-types]
2013-01-23 01:57:51 +02:00
Emmanuel Merali
3fb643211e Retry delay - selectDB on array
Added the possibility to delay each reconnection attempt, including a
random factor to prevent several or many concurrent connections from
trying to reconnect at the same time.
Added the select command to RedisArray to select a DB on every
connections in one instruction.
2013-01-21 18:10:16 +02: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