8000 Made igbinary optional. · jrtkcoder/phpredis@f42d90b · GitHub
[go: up one dir, main page]

Skip to content

Commit f42d90b

Browse files
committed
Made igbinary optional.
1 parent 97f6037 commit f42d90b

24 files changed

+68
-3091
lines changed

README.markdown

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ Error handling
6060

6161
phpredis throws a `RedisException` object if it can't reach the Redis server. That can happen in case of connectivity issues, if the Redis service is down, or if the redis host is overloaded. In any other problematic case that does not involve an unreachable server (such as a key not existing, an invalid command, etc), phpredis will return `FALSE`.
6262

63+
Igbinary
64+
==============
65+
66+
phpredis supports Igbinary serialization when configured with `--enable-redis-igbinary`. Igbinary can be installed from PECL: `sudo pecl install igbinary`. Igbinary is much more efficient than the standard PHP `serialize()`.
67+
68+
6369
Methods
6470
=========
6571

@@ -151,7 +157,7 @@ Set client option.
151157
<pre>
152158
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE); // don't serialize data
153159
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP); // use built-in serialize/unserialize
154-
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY); // use igBinary serialize/unserialize
160+
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY); // use Igbinary serialize/unserialize, only if enabled in `.configure` script.
155161

156162
$redis->setOption(Redis::OPT_PREFIX, 'myAppName:'); // use custom prefix on all keys
157163
</pre>

config.m4

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,48 @@ PHP_ARG_ENABLE(redis, whether to enable redis support,
55
dnl Make sure that the comment is aligned:
66
[ --enable-redis Enable redis support])
77

8+
PHP_ARG_ENABLE(redis-igbinary, whether to enable igbinary serializer support,
9+
[ --enable-redis-igbinary Enable igbinary serializer support], no, no)
10+
811
if test "$PHP_REDIS" != "no"; then
12+
if test "$PHP_REDIS_IGBINARY" != "no"; then
13+
AC_MSG_CHECKING([for igbinary includes])
14+
igbinary_inc_path=""
15+
16+
if test -f "$abs_srcdir/include/php/ext/igbinary/igbinary.h"; then
17+
igbinary_inc_path="$abs_srcdir/include/php"
18+
elif test -f "$abs_srcdir/ext/igbinary/igbinary.h"; then
19+
igbinary_inc_path="$abs_srcdir"
20+
elif test -f "$phpincludedir/ext/session/igbinary.h"; then
21+
igbinary_inc_path="$phpincludedir"
22+
else
23+
for i in php php4 php5 php6; do
24+
if test -f "$prefix/include/$i/ext/igbinary/igbinary.h"; then
25+
igbinary_inc_path="$prefix/include/$i"
26+
fi
27+
done
28+
fi
29+
30+
if test "$igbinary_inc_path" = ""; then
31+
AC_MSG_ERROR([Cannot find igbinary.h])
32+
else
33+
AC_MSG_RESULT([$igbinary_inc_path])
34+
fi
35+
fi
36+
37+
AC_MSG_CHECKING([for redis igbinary support])
38+
if test "$PHP_REDIS_IGBINARY" != "no"; then
39+
AC_MSG_RESULT([enabled])
40+
AC_DEFINE(HAVE_REDIS_IGBINARY,1,[Whether redis igbinary serializer is enabled])
41+
IGBINARY_INCLUDES="-I$igbinary_inc_path"
42+
ifdef([PHP_ADD_EXTENSION_DEP],
43+
[
44+
PHP_ADD_EXTENSION_DEP(redis, igbinary)
45+
])
46+
else
47+
IGBINARY_INCLUDES=""
48+
AC_MSG_RESULT([disabled])
49+
fi
950

1051
dnl # --with-redis -> check with-path
1152
dnl SEARCH_PATH="/usr/local /usr" # you might want to change this
@@ -46,5 +87,5 @@ if test "$PHP_REDIS" != "no"; then
4687
dnl
4788
dnl PHP_SUBST(REDIS_SHARED_LIBADD)
4889

49-
PHP_NEW_EXTENSION(redis, redis.c library.c redis_session.c igbinary/igbinary.c igbinary/hash_si.c igbinary/hash_function.c, $ext_shared)
90+
PHP_NEW_EXTENSION(redis, redis.c library.c redis_session.c, $ext_shared)
5091
fi

igbinary/.gitignore

Lines changed: 0 additions & 53 deletions
This file was deleted.

igbinary/COPYING

Lines changed: 0 additions & 28 deletions
This file was deleted.

igbinary/CREDITS

Lines changed: 0 additions & 8 deletions
This file was deleted.

igbinary/ChangeLog

Lines changed: 0 additions & 10 deletions
This file was deleted.

igbinary/EXPERIMENTAL

Whitespace-only changes.

igbinary/NEWS

Lines changed: 0 additions & 8 deletions
This file was deleted.

igbinary/README

Lines changed: 0 additions & 95 deletions
This file was deleted.

igbinary/config.m4

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0