PHP compatibility

52 views
Skip to first unread message

Radek

unread,
Feb 23, 2012, 10:42:38 PM2/23/12
to spymemcached
Hello,

I am having issues with configuring Spymemcached with PHP. I am
storing cache in PHP and would like to read it in Java. I can read
some keys correctly but I am unable to find all the keys. It looks
like hashing between Pecl/memcached and Spymemcached is not
compatible.

Here is my configuration:
In PHP I make sure to set the option: $memcache-
>setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);

In Java I use the following configuration:
this.client = new MemcachedClient(
new ConnectionFactoryBuilder ()
.setProtocol (Protocol.TEXT)
.setHashAlg (DefaultHashAlgorithm.KETAMA_HASH)
.setFailureMode (FailureMode.Redistribute)
.setLocatorType (Locator.CONSISTENT),
AddrUtil.getAddresses(servers));

I tried to initialise memcached clients on both PHP and Java side in
dozens of different ways but to no avail. I can read part of the keys
but not all of them. I can read all keys on the PHP side so it's not
the issue with a server being down. I use latest versions of Pecl/
Memcached and spymemcached.

While looking for an answer I spotted this post:
http://groups.google.com/group/spymemcached/browse_thread/thread/c64770255b0faf28
I tried to expose in Pecl/memcached the libmemcached API by enabling
the following option:
memcached_behavior_set(m_obj->memc, MEMCACHED_BEHAVIOR_DISTRIBUTION,
MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA);
That didn't help either.

The only working example of memcached Java working with PHP I was able
to find was: http://groups.google.com/group/xmemcached/browse_thread/thread/63207d43af54e0d9
Unfortunately this is not using spymemcached.

In the end whatever I try I am unable to read all the keys stored in
PHP. I've read on this group that Spymemcached should work just fine
with Pecl/Memcached. Did anyone manage to connect PHP Pecl/memcached
with Spymemcached and can provide me some tips on how to create a new
client on PHP and Java side?

Many thanks,
Radek

Matt Ingenthron

unread,
Feb 27, 2012, 3:50:23 AM2/27/12
to spymem...@googlegroups.com

which version of spy?   also, can you name a key hashing differently?

--
You received this message because you are subscribed to the Google Groups "spymemcached" group.
To post to this group, send email to spymem...@googlegroups.com.
To unsubscribe from this group, send email to spymemcached...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spymemcached?hl=en.

Reply all
Reply to author
Forward
0 new messages