Pavlo Yatsukhnenko
8cb2d5bd94
Issue #1048
...
This commit is adding support of data compression.
LZF was choosen because it small and fast and Redis server uses it.
Since [pecl package](https://pecl.php.net/package/lzf ) doesn't provide
lzf.h file after installing, LZF library was added as submodule.
Another algorythms may be easely added by analogy with serializers.
TODO: unit-tests for different data types.
2017-10-17 17:08:42 +03:00
Pavlo Yatsukhnenko
b9ca16cc5b
fix memory leak added in PR #1247
2017-10-17 16:26:15 +03:00
Pavlo Yatsukhnenko
ec4fd1bde0
Issue #1238
...
This change allows to use empty string as persistant_id
2017-10-09 15:39:11 +03:00
Pavlo Yatsukhnenko
99335d6081
Don't use convert_to_string in redis_hmget_cmd
2017-09-29 17:19:45 +03:00
michael-grunder
345fc7fc9f
Destroy all tabs :-)
2017-09-28 15:44:18 -07:00
Pavlo Yatsukhnenko
2bf7b2f714
Use zend_string to store strings in RedisSock
...
Following fields were changed: err, prefix, persistent_id, auth and host
2017-08-16 16:58:10 +03:00
michael-grunder
af71d42268
Avoid a coverty warning for failure to check return value.
2017-08-15 14:45:41 -07:00
michael-grunder
d11798e18b
* Only attempt to set TCP_NODELAY on TCP sockets and also don't abort
...
if we can't.
* Stop throwing warnings if users double up on pipeline or multi calls
reverting to previous behavior.
2017-08-14 12:36:34 -07:00
Pavlo Yatsukhnenko
4e32254ec2
Use ZSTR_VAL and ZSTR_LEN macroses to access zend_string fields
2017-08-02 13:20:30 +03:00
Pavlo Yatsukhnenko
7c140714e3
Remove redis_get_exception_base
2017-08-01 18:07:33 +03:00
Pavlo Yatsukhnenko
eff7398606
CID 158614, 158615
2017-07-28 13:45:43 +03:00
Pavlo Yatsukhnenko
be599147ad
runtime exteption
2017-07-25 16:03:02 +03:00
Pavlo Yatsukhnenko
0438ab4200
CID 157204
2017-07-20 23:34:09 +03:00
Pavlo Yatsukhnenko
26eeda5b36
CID 157208
2017-07-20 23:26:52 +03:00
Pavlo Yatsukhnenko
735025d700
Fix some static analyzer warnings
...
Two types of warnings were fixed in this commit:
1. The left operand of '<=' is a garbage value
2. Function call argument is an uninitialized value
2017-07-19 15:13:33 +03:00
Pavlo Yatsukhnenko
ea15ce24cd
Remove redis_send_discard duplication
2017-07-13 00:13:19 +03:00
michael-grunder
7807e875fb
Don't use free as variable name.
2017-05-03 14:36:19 +03:00
michael-grunder
6a74b959b3
Remove integer_length function
2017-04-28 16:02:04 -07:00
michael-grunder
f2d1ccf7c6
Actual removal of redis_cmd_format_static function
2017-04-28 15:57:59 -07:00
michael-grunder
0eaeae0f46
Replace redis_cmd_format_static with redis_spprintf
2017-04-28 12:30:58 -07:00
michael-grunder
5d35acd246
Remove redis_cmd_append_str and redis_cmd_append_int
2017-04-28 08:23:13 -07:00
michael-grunder
0970ddef03
Remove redis_cmd_format_header command completely
2017-04-28 08:21:00 -07:00
michael-grunder
f880655faa
Removes legacy function redis_cmd_format()
2017-04-27 22:35:46 -07:00
michael-grunder
a4a0ed5f8a
Initial commit of refactored command construction
...
This commit adds a new printf like command construction function
with additionaly format specifiers specific to phpredis. Because
phpredis can be configured to automatically prefix keys and/or
automatically serialize values we had a great deal of redundant
boilerplate code.
zend_parse_paramaters(..., "sz", &key, &keylen, &z_arg);
keyfree = redis_key_prefix(redis_sock, &key, &keylen);
valfree = redis_serialize(redis_sock, z_val, &realval, &reallen);
/* More processing */
if (keyfree) efree(key);
if (valfree) efree(val);
Now it is possible to use redis_spprintf and use format specifiers
specific to these tasks, which will handle prefixing or serialization
(as well as memory cleanup) automatically:
/* The library function will automatically prefix and serialize values
if phpredis has been configured to do that */
len = phpredis_spprintf(redis_sock, slot TRMLS_CC, "SET", "kv", key,
key_len, z_value);
2017-04-26 16:55:20 -07:00
Pavlo Yatsukhnenko
c8079eec83
Remove REDIS_DOUBLE_TO_STRING macros
2017-04-21 20:32:31 +03:00
Pavlo Yatsukhnenko
43e1e0faff
refactoring ( #1155 )
...
Fix memory leak in `redis_long_response` when LONG_MAX overflow.
Add return -1 in `redis_read_reply_type` when `php_stream_getc` returns EOF.
Code formatting in `PHP_METHOD(Redis, exec)`.
2017-04-21 00:30:37 +03:00
Pavlo Yatsukhnenko
e372398344
Modifying redis_error_throw to throw exception for all non recoverable errors.
2017-04-12 00:03:21 +03:00
Pavlo Yatsukhnenko
b56dc49eec
Processing read_timeout parameter + update docs
2017-04-11 15:22:46 +03:00
Pavlo Yatsukhnenko
520e06a8a9
Increasing read buffers size.
...
When Redis server is running in protected mode it returns error message
more than 1024 bites long so first call of redis_sock_gets doesn't read whole
message and next call causes "protocol error, got '%c' as reply type byte"
exception.
2017-04-05 14:47:34 +03:00
Pavlo Yatsukhnenko
1f8dde4a99
refactor redis_1_response + fix memory leak in redis_long_response
2017-04-01 23:39:58 +03:00
Pavlo Yatsukhnenko
18149e34e4
refactoring ( #1140 )
...
* refactoring
* Fix read_timeout
2017-04-01 12:12:47 +03:00
Pavlo Yatsukhnenko
bf499ee318
Return -1 from redis_sock_gets on error.
2017-03-30 14:12:00 +03:00
Pavlo Yatsukhnenko
ef6e0876be
Use redis_sock_gets instread of redis_sock_eof + php_stream_gets
...
- redis_mbulk_reply_assoc
- redis_mbulk_reply_raw
- redis_mbulk_reply_zipped
- redis_sock_read
- redis_sock_read_multibulk_multi_reply
- redis_sock_read_multibulk_reply
- redis_sock_read_multibulk_reply_zval
2017-03-30 12:07:58 +03:00
Pavlo Yatsukhnenko
e7ad31e515
Remove unused force_connect parameter from redis_sock_server_open function.
2017-03-29 23:33:53 +03:00
Pavlo Yatsukhnenko
434bb5ad5c
Remove REDIS_SOCK_STATUS_UNKNOWN because no way to reach it.
2017-03-29 23:28:56 +03:00
michael-grunder
bd16da641c
Small formatting fix
2017-03-25 15:14:01 -07:00
Pavlo Yatsukhnenko
74ba34bc71
refactor redis_sock_read_bulk_reply
...
Throws error and returns NULL when we read less bytes than expected.
This patch probably fixes "protocol error, got '' as reply type byte" error.
2017-03-25 15:04:26 -07:00
michael-grunder
83ac4baef1
Pedantic fix for zval changes in 5/7
2017-03-24 12:37:01 -07:00
michael-grunder
88efaa89a1
Fixes potential (but unreported) segfault in release code.
2017-03-22 23:01:59 +02:00
Pavlo Yatsukhnenko
a070a43fcb
refactoring
...
In pipeline mode all commands are now stored in the buffer
the memory for which is allocated with emalloc.
There is no need to use a linked list.
2017-03-10 07:24:34 +02:00
Pavlo Yatsukhnenko
c4b11a9368
put macros in order
2017-02-27 16:41:16 +02:00
Pavlo Yatsukhnenko
43da980da9
redis_check_eof refactoring
2017-02-17 00:19:19 +02:00
Pavlo Yatsukhnenko
388e4a8456
refactoring
...
New implementation of redis_parse_info_response function without
estrndup using and with long/double/string values
2017-02-09 23:21:04 +02:00
Pavlo Yatsukhnenko
12a333534f
redis_sock_write refactoring
...
Check the number of bytes returned by `php_stream_write`.
Use SOCKET_WRITE_COMMAND macro.
2017-01-08 00:22:12 +02:00
Pavlo Yatsukhnenko
c90649a6d5
redis_boolean_response_impl refactoring
2017-01-04 23:32:29 +02:00
Remi Collet
37c754a44a
change redis_sock_read_scan_reply to use zend_long
2016-12-21 09:48:39 +01:00
Remi Collet
1435d4540a
change redis_serialize to accept strlen_t
2016-12-21 09:28:34 +01:00
Remi Collet
c9825cc8c8
fix #1074 change redis_key_prefix to accept strlen_t
2016-12-21 09:13:36 +01:00
michael-grunder
85e0b9e7b2
Merge branch 'develop' into issue.1054
2016-12-18 21:26:55 -08:00
michael-grunder
d0b8011a9a
Fix compiler warnings.
...
Changed zend hash function overrides to extern in the header, and
then defined them in library.c
Created a simple macro to suppress "set but not used" warnings,
which differ depending on build environment (php 5 vs php 7).
2016-12-18 21:06:38 -08:00