Skip to content

Commit 426a302

Browse files
author
Nicolas Van Eenaeme
committed
Merge remote-tracking branch 'parent/master' into feature-udf
2 parents e4ae8fb + 3c6e305 commit 426a302

28 files changed

+1113
-341
lines changed

.travis.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
language: php
2+
php:
3+
- 5.5
4+
#- 5.4
5+
#- 5.3
6+
env:
7+
- LIBMEMCACHED_VERSION=1.0.17
8+
- LIBMEMCACHED_VERSION=1.0.16
9+
- LIBMEMCACHED_VERSION=1.0.15
10+
- LIBMEMCACHED_VERSION=1.0.14
11+
- LIBMEMCACHED_VERSION=1.0.10
12+
- LIBMEMCACHED_VERSION=1.0.8
13+
- LIBMEMCACHED_VERSION=1.0.2
14+
- LIBMEMCACHED_VERSION=0.53
15+
- LIBMEMCACHED_VERSION=0.44
16+
17+
before_script:
18+
- for file in tests/*.phpt; do grep $(basename $file) package.xml >/dev/null || (echo "Missing $file from package.xml" ; exit 1); done
19+
- wget "https://launchpad.net/libmemcached/1.0/${LIBMEMCACHED_VERSION}/+download/libmemcached-${LIBMEMCACHED_VERSION}.tar.gz"
20+
- tar xvfz libmemcached-${LIBMEMCACHED_VERSION}.tar.gz
21+
- cd libmemcached-${LIBMEMCACHED_VERSION}
22+
- ./configure --prefix="${HOME}/libmemcached-${LIBMEMCACHED_VERSION}" LDFLAGS="-lpthread"
23+
- make
24+
- make install
25+
- cd ..
26+
27+
28+
script:
29+
- export PHP_MEMCACHED_VERSION=$(php -r '$sxe = simplexml_load_file ("package.xml"); echo (string) $sxe->version->release;')
30+
- pear package
31+
- mkdir /tmp/php-memcached-build
32+
- tar xfz "memcached-${PHP_MEMCACHED_VERSION}.tgz" -C /tmp/php-memcached-build
33+
- cd /tmp/php-memcached-build/memcached-${PHP_MEMCACHED_VERSION}
34+
- phpize
35+
- ./configure --with-libmemcached-dir="${HOME}/libmemcached-${LIBMEMCACHED_VERSION}"
36+
- make
37+
- export NO_INTERACTION=1
38+
- export REPORT_EXIT_STATUS=1
39+
- export TEST_PHP_EXECUTABLE=`which php`
40+
- php run-tests.php -d extension=memcached.so -d extension_dir=modules -n ./tests/*.phpt
41+
- for i in `ls tests/*.out 2>/dev/null`; do echo "-- START ${i}"; cat $i; echo ""; echo "-- END"; done
42+
43+

ChangeLog

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
memcached extension changelog
22

3+
Version 2.2.0b1
4+
---------------
5+
* Reinstate support for libememcached 0.x series
6+
* Added SASL support to session handler
7+
* Added Memcached::flushBuffers as per GH #78
8+
* Fixes GH #54: Fixed UDP server adding with newer libmemcached
9+
* Fixed PHP bug #65334: (Segfault if uncompress value failed)
10+
* Fixes GH #14: get with cas token fails to fetch all results
11+
* Fixes GH #68: memcached 2.1.0 requires libmemcached 1.0.10
12+
* Fixes GH #69: compiling on CentOS 6.4 with libmemcached 1.0.17
13+
* Merged PR #91: memcached.sess_lock_wait and memcached.sess_lock_max_wait
14+
* Added session handler settings:
15+
- memcached.sess_number_of_replicas
16+
- memcached.sess_randomize_replica_read
17+
- memcached.sess_remove_failed
18+
- memcached.sess_connect_timeout
19+
320
Version 2.1.0
421
-------------
522
* Drop support for libmemcached 0.x series, now 1.0.x is required
@@ -41,8 +58,6 @@ Version 2.0.0b2
4158

4259
Version 2.0.0b1
4360
---------------
44-
* Change the return value for non-existing keys to be NULL rather than
45-
'false', affects simple get only
4661
* Add fastlz library that provides better/faster payload compression
4762
* Add configure switch to enable/disable JSON serialization support
4863
* Add getAllKeys() method

README.markdown

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Build Status
2+
------------
3+
[![Build Status](https://travis-ci.org/php-memcached-dev/php-memcached.png?branch=master)](https://travis-ci.org/php-memcached-dev/php-memcached)
4+
15
Description
26
-----------
37
This extension uses libmemcached library to provide API for communicating with
@@ -7,8 +11,16 @@ memcached is a high-performance, distributed memory object caching system,
711
generic in nature, but intended for use in speeding up dynamic web applications
812
by alleviating database load.
913

14+
Building
15+
--------
16+
17+
$ phpize
18+
$ ./configure
19+
$ make
20+
$ make test
21+
1022
Resources
1123
---------
12-
* [libmemcached](http://tangent.org/552/libmemcached.html)
13-
* [memcached](http://www.danga.com/memcached/)
24+
* [libmemcached](http://libmemcached.org/libMemcached.html)
25+
* [memcached](http://memcached.org/)
1426
* [igbinary](https://github.com/phadej/igbinary/)

config.m4

+96-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ PHP_ARG_ENABLE(memcached-json, whether to enable memcached json serializer suppo
1818
[ --enable-memcached-json Enable memcached json serializer support], no, no)
1919

2020
PHP_ARG_ENABLE(memcached-sasl, whether to disable memcached sasl support,
21-
[ --disable-memcached-sasl Disable memcached sasl support], no, no)
21+
[ --disable-memcached-sasl Disable memcached sasl support], yes, no)
2222

2323
if test -z "$PHP_ZLIB_DIR"; then
2424
PHP_ARG_WITH(zlib-dir, for ZLIB,
@@ -224,8 +224,8 @@ if test "$PHP_MEMCACHED" != "no"; then
224224

225225
AC_MSG_CHECKING([for libmemcached location])
226226
if test "$PHP_LIBMEMCACHED_DIR" != "no" && test "$PHP_LIBMEMCACHED_DIR" != "yes"; then
227-
if ! test -r "$PHP_LIBMEMCACHED_DIR/include/libmemcached-1.0/memcached.h"; then
228-
AC_MSG_ERROR([Can't find libmemcached 1.0.x headers under "$PHP_LIBMEMCACHED_DIR"])
227+
if ! test -r "$PHP_LIBMEMCACHED_DIR/include/libmemcached/memcached.h"; then
228+
AC_MSG_ERROR([Can't find libmemcached headers under "$PHP_LIBMEMCACHED_DIR"])
229229
fi
230230
else
231231
PHP_LIBMEMCACHED_DIR="no"
@@ -238,17 +238,108 @@ if test "$PHP_MEMCACHED" != "no"; then
238238
fi
239239

240240
if test "$PHP_LIBMEMCACHED_DIR" = "no"; then
241-
AC_MSG_ERROR([memcached support requires libmemcached 1.0.x. Use --with-libmemcached-dir=<DIR> to specify the prefix where libmemcached headers and library are located])
241+
AC_MSG_ERROR([memcached support requires libmemcached. Use --with-libmemcached-dir=<DIR> to specify the prefix where libmemcached headers and library are located])
242242
else
243243
AC_MSG_RESULT([$PHP_LIBMEMCACHED_DIR])
244244

245245
PHP_LIBMEMCACHED_INCDIR="$PHP_LIBMEMCACHED_DIR/include"
246246
PHP_ADD_INCLUDE($PHP_LIBMEMCACHED_INCDIR)
247247
PHP_ADD_LIBRARY_WITH_PATH(memcached, $PHP_LIBMEMCACHED_DIR/$PHP_LIBDIR, MEMCACHED_SHARED_LIBADD)
248248

249+
ORIG_CFLAGS="$CFLAGS"
250+
ORIG_LIBS="$LIBS"
251+
252+
CFLAGS="$CFLAGS -I$PHP_LIBMEMCACHED_INCDIR"
253+
254+
#
255+
# Added -lpthread here because AC_TRY_LINK tests on CentOS 6 seem to fail with undefined reference to pthread_once
256+
#
257+
LIBS="$LIBS -lpthread -lmemcached -L$PHP_LIBMEMCACHED_DIR/$PHP_LIBDIR"
258+
259+
AC_CACHE_CHECK([whether memcached_instance_st is defined], ac_cv_have_memcached_instance_st, [
260+
AC_TRY_COMPILE(
261+
[ #include <libmemcached/memcached.h> ],
262+
[ const memcached_instance_st *instance = NULL; ],
263+
[ ac_cv_have_memcached_instance_st="yes" ],
264+
[ ac_cv_have_memcached_instance_st="no" ]
265+
)
266+
])
267+
268+
AC_CACHE_CHECK([whether MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS is defined], ac_cv_have_libmemcached_remove_failed_servers, [
269+
AC_TRY_COMPILE(
270+
[ #include <libmemcached/memcached.h> ],
271+
[ MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS; ],
272+
[ ac_cv_have_libmemcached_remove_failed_servers="yes" ],
273+
[ ac_cv_have_libmemcached_remove_failed_servers="no" ]
274+
)
275+
])
276+
277+
AC_CACHE_CHECK([whether MEMCACHED_SERVER_TEMPORARILY_DISABLED is defined], ac_cv_have_libmemcached_server_temporarily_disabled, [
278+
AC_TRY_COMPILE(
279+
[ #include <libmemcached/memcached.h> ],
280+
[ MEMCACHED_SERVER_TEMPORARILY_DISABLED; ],
281+
[ ac_cv_have_libmemcached_server_temporarily_disabled="yes" ],
282+
[ ac_cv_have_libmemcached_server_temporarily_disabled="no" ]
283+
)
284+
])
285+
286+
AC_CACHE_CHECK([whether memcached function exists], ac_cv_have_libmemcached_memcached, [
287+
AC_TRY_LINK(
288+
[ #include <libmemcached/memcached.h> ],
289+
[ memcached("t", sizeof ("t")); ],
290+
[ ac_cv_have_libmemcached_memcached="yes" ],
291+
[ ac_cv_have_libmemcached_memcached="no" ]
292+
)
293+
])
294+
295+
AC_CACHE_CHECK([whether libmemcached_check_configuration function exists], ac_cv_have_libmemcached_check_configuration, [
296+
AC_TRY_LINK(
297+
[ #include <libmemcached/memcached.h> ],
298+
[ libmemcached_check_configuration("", 1, "", 1); ],
299+
[ ac_cv_have_libmemcached_check_configuration="yes" ],
300+
[ ac_cv_have_libmemcached_check_configuration="no" ]
301+
)
302+
])
303+
304+
AC_CACHE_CHECK([whether memcached_touch function exists], ac_cv_have_libmemcached_touch, [
305+
AC_TRY_LINK(
306+
[ #include <libmemcached/memcached.h> ],
307+
[ memcached_touch (NULL, NULL, 0, 0); ],
308+
[ ac_cv_have_libmemcached_touch="yes" ],
309+
[ ac_cv_have_libmemcached_touch="no" ]
310+
)
311+
])
312+
313+
CFLAGS="$ORIG_CFLAGS"
314+
LIBS="$ORIG_LIBS"
315+
316+
if test "$ac_cv_have_memcached_instance_st" = "yes"; then
317+
AC_DEFINE(HAVE_MEMCACHED_INSTANCE_ST, [1], [Whether memcached_instance_st is defined])
318+
fi
319+
320+
if test "$ac_cv_have_libmemcached_remove_failed_servers" = "yes"; then
321+
AC_DEFINE(HAVE_LIBMEMCACHED_REMOVE_FAILED_SERVERS, [1], [Whether MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS is defined])
322+
fi
323+
324+
if test "$ac_cv_have_libmemcached_server_temporarily_disabled" = "yes"; then
325+
AC_DEFINE(HAVE_LIBMEMCACHED_SERVER_TEMPORARILY_MARKER_DISABLED, [1], [Whether MEMCACHED_SERVER_TEMPORARILY_DISABLED is defined])
326+
fi
327+
328+
if test "$ac_cv_have_libmemcached_memcached" = "yes"; then
329+
AC_DEFINE(HAVE_LIBMEMCACHED_MEMCACHED, [1], [Whether memcached is defined])
330+
fi
331+
332+
if test "$ac_cv_have_libmemcached_check_configuration" = "yes"; then
333+
AC_DEFINE(HAVE_LIBMEMCACHED_CHECK_CONFIGURATION, [1], [Whether libmemcached_check_configuration is defined])
334+
fi
335+
336+
if test "$ac_cv_have_libmemcached_touch" = "yes"; then
337+
AC_DEFINE(HAVE_LIBMEMCACHED_TOUCH, [1], [Whether memcached_touch is defined])
338+
fi
339+
249340
PHP_SUBST(MEMCACHED_SHARED_LIBADD)
250341

251-
PHP_MEMCACHED_FILES="php_memcached.c fastlz/fastlz.c g_fmt.c"
342+
PHP_MEMCACHED_FILES="php_memcached.c php_libmemcached_compat.c fastlz/fastlz.c g_fmt.c"
252343

253344
if test "$PHP_MEMCACHED_SESSION" != "no"; then
254345
PHP_MEMCACHED_FILES="${PHP_MEMCACHED_FILES} php_memcached_session.c"

memcached-api.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,9 @@ public function deleteMulti( array $keys, $expiration = 0 ) {}
241241

242242
public function deleteMultiByKey( $server_key, array $keys, $expiration = 0 ) {}
243243

244-
public function increment( $key, $offset = 1) {}
244+
public function increment( $key, $offset = 1, $initial_value = 0, $expiry = 0) {}
245245

246-
public function decrement( $key, $offset = 1) {}
246+
public function decrement( $key, $offset = 1, $initial_value = 0, $expiry = 0) {}
247247

248248
public function getOption( $option ) {}
249249

@@ -281,6 +281,8 @@ public function isPersistent( ) {}
281281

282282
public function isPristine( ) {}
283283

284+
public function setSaslAuthData( $username, $password ) {}
285+
284286
}
285287

286288
class MemcachedException extends Exception {

memcached.ini

+32-4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@ memcached.sess_locking = On
1212
; the default is 150000
1313
memcached.sess_lock_wait = 150000
1414

15+
; The maximum time, in seconds, to wait for a session lock
16+
; before timing out.
17+
; Setting to 0 results in default behavior, which is to
18+
; use max_execution_time.
19+
memcached.sess_lock_max_wait = 0;
20+
21+
; The time, in seconds, before a lock should release itself.
22+
; Setting to 0 results in the default behaviour, which is to
23+
; use the memcached.sess_lock_max_wait setting. If that is
24+
; also 0, max_execution_time will be used.
25+
memcached.sess_lock_expire = 0;
26+
1527
; memcached session key prefix
1628
; valid values are strings less than 219 bytes long
1729
; the default value is "memc.sess.key."
@@ -35,18 +47,28 @@ memcached.sess_remove_failed = 1
3547
; from a replica. However, if the failed memcache server
3648
; becomes available again it will read the session from there
3749
; which could have old data or no data at all
38-
memcached.sess_num_replicas = 0;
50+
memcached.sess_number_of_replicas = 0
3951

4052
; memcached session binary mode
4153
; libmemcached replicas only work if binary mode is enabled
4254
memcached.sess_binary = Off
4355

44-
; memcached session number of replicas
45-
memcached.sess_number_of_replicas = 0
46-
4756
; memcached session replica read randomize
4857
memcached.sess_randomize_replica_read = Off
4958

59+
; memcached connect timeout value
60+
; In non-blocking mode this changes the value of the timeout
61+
; during socket connection in milliseconds. Specifying -1 means an infinite timeout.
62+
memcached.sess_connect_timeout = 1000
63+
64+
; Session SASL username
65+
; Both username and password need to be set for SASL to be enabled
66+
; In addition to this memcached.use_sasl needs to be on
67+
memcached.sess_sasl_username = NULL
68+
69+
; Session SASL password
70+
memcached.sess_sasl_password = NULL
71+
5072
; Set the compression type
5173
; valid values are: fastlz, zlib
5274
; the default is fastlz
@@ -81,3 +103,9 @@ memcached.compression_threshold = 2000
81103
;
82104
; The default is igbinary if available and php otherwise.
83105
memcached.serializer = "igbinary"
106+
107+
; Use SASL authentication for connections
108+
; valid values: On, Off
109+
; the default is Off
110+
memcached.use_sasl = Off
111+

0 commit comments

Comments
 (0)