|
| 1 | +/* |
| 2 | + +----------------------------------------------------------------------+ |
| 3 | + | Copyright (c) 2009 The PHP Group | |
| 4 | + +----------------------------------------------------------------------+ |
| 5 | + | This source file is subject to version 3.0 of the PHP license, | |
| 6 | + | that is bundled with this package in the file LICENSE, and is | |
| 7 | + | available through the world-wide-web at the following url: | |
| 8 | + | http://www.php.net/license/3_0.txt. | |
| 9 | + | If you did not receive a copy of the PHP license and are unable to | |
| 10 | + | obtain it through the world-wide-web, please send a note to | |
| 11 | + | [email protected] so we can mail you a copy immediately. | |
| 12 | + +----------------------------------------------------------------------+ |
| 13 | + | Authors: Andrei Zmievski <[email protected]> | |
| 14 | + +----------------------------------------------------------------------+ |
| 15 | +*/ |
| 16 | + |
| 17 | +#include "php_memcached.h" |
| 18 | +#include "php_memcached_private.h" |
| 19 | +#include "php_libmemcached_compat.h" |
| 20 | + |
| 21 | +memcached_return php_memcached_exist (memcached_st *memc, zend_string *key) |
| 22 | +{ |
| 23 | +#ifdef HAVE_MEMCACHED_EXIST |
| 24 | + return memcached_exist (memc, key->val, key->len); |
| 25 | +#else |
| 26 | + memcached_return rc = MEMCACHED_SUCCESS; |
| 27 | + uint32_t flags = 0; |
| 28 | + size_t value_length = 0; |
| 29 | + char *value = NULL; |
| 30 | + |
| 31 | + value = memcached_get (memc, key->val, key->len, &value_length, &flags, &rc); |
| 32 | + if (value) { |
| 33 | + free (value); |
| 34 | + } |
| 35 | + return rc; |
| 36 | +#endif |
| 37 | +} |
0 commit comments