Created
December 10, 2014 20:49
-
-
Save adsr/d5dca80a0f81de4e0494 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/hphp/runtime/ext/memcached/ext_memcached.cpp b/hphp/runtime/ext/memcached/ext_memcached.cpp | |
index 4300861..ecfa56d 100644 | |
--- a/hphp/runtime/ext/memcached/ext_memcached.cpp | |
+++ b/hphp/runtime/ext/memcached/ext_memcached.cpp | |
@@ -93,8 +93,10 @@ const int64_t q_Memcached$$DISTRIBUTION_CONSISTENT | |
= MEMCACHED_DISTRIBUTION_CONSISTENT; | |
const int64_t q_Memcached$$DISTRIBUTION_CONSISTENT_KETAMA | |
= MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA; | |
+#ifdef MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED | |
const int64_t q_Memcached$$DISTRIBUTION_CONSISTENT_WEIGHTED | |
= MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED; | |
+#endif | |
const int64_t q_Memcached$$OPT_LIBKETAMA_COMPATIBLE | |
= MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED; | |
const int64_t q_Memcached$$OPT_BUFFER_WRITES | |
@@ -1208,7 +1210,9 @@ IMPLEMENT_THREAD_LOCAL(MemcachedData::ImplMap, MemcachedData::s_persistentMap); | |
const StaticString s_Memcached("Memcached"); | |
const StaticString s_DISTRIBUTION_CONSISTENT("DISTRIBUTION_CONSISTENT"); | |
const StaticString s_DISTRIBUTION_CONSISTENT_KETAMA("DISTRIBUTION_CONSISTENT_KETAMA"); | |
+#ifdef MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED | |
const StaticString s_DISTRIBUTION_CONSISTENT_WEIGHTED("DISTRIBUTION_CONSISTENT_WEIGHTED"); | |
+#endif | |
const StaticString s_DISTRIBUTION_MODULA("DISTRIBUTION_MODULA"); | |
const StaticString s_GET_PRESERVE_ORDER("GET_PRESERVE_ORDER"); | |
const StaticString s_HASH_CRC("HASH_CRC"); | |
@@ -1332,10 +1336,12 @@ class MemcachedExtension : public Extension { | |
s_Memcached.get(), s_DISTRIBUTION_CONSISTENT_KETAMA.get(), | |
q_Memcached$$DISTRIBUTION_CONSISTENT_KETAMA | |
); | |
+#ifdef MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED | |
Native::registerClassConstant<KindOfInt64>( | |
s_Memcached.get(), s_DISTRIBUTION_CONSISTENT_WEIGHTED.get(), | |
q_Memcached$$DISTRIBUTION_CONSISTENT_WEIGHTED | |
); | |
+#endif | |
Native::registerClassConstant<KindOfInt64>( | |
s_Memcached.get(), s_DISTRIBUTION_MODULA.get(), | |
q_Memcached$$DISTRIBUTION_MODULA | |
diff --git a/hphp/test/slow/ext_memcached/ketama_opt.php.skipif b/hphp/test/slow/ext_memcached/ketama_opt.php.skipif | |
new file mode 100644 | |
index 0000000..e3b27f7 | |
--- /dev/null | |
+++ b/hphp/test/slow/ext_memcached/ketama_opt.php.skipif | |
@@ -0,0 +1,7 @@ | |
+<?php | |
+ | |
+$memc = new Memcached(); | |
+$refl = new ReflectionClass($memc); | |
+if ($refl->getConstant('DISTRIBUTION_CONSISTENT_WEIGHTED') === false) { | |
+ echo "SKIP Memcached::DISTRIBUTION_CONSISTENT_WEIGHTED not defined"; | |
+} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment