Question to Cache::Memcached

Greg Whalin greg@meetup.com
Tue, 8 Jun 2004 18:25:18 -0400 (EDT)


For the Java client I wrote, I decided to keep the hashing method from the
perl code as an optional hashing method (for compatibility between
different clients), however, by default, I am using String.hashCode(),
which is faster (given java's String pooling and keeping the hash cached
in the object) but not compatible with the hashing used by the perl
client (the hashing algorithm is slightly different).

I do however think it is important that all the clients try to remain
compatible with each other as much as possible. Never know when someone
will want to store an object in a java app and retrieve it from a perl
app.

Greg
greg@meetup.com

On Tue, 8 Jun 2004, Michael Granger wrote:

> Date: Tue, 8 Jun 2004 15:13:38 -0700
> From: Michael Granger <ged@FaerieMUD.org>
> To: memcached@lists.danga.com
> Subject: Re: Question to Cache::Memcached
> 
> On Jun 8, 2004, at 12:42 PM, Evan Martin wrote:
> 
> > I could've sworn Perl exposed its internal hash function that it uses
> > for its own hashes--I think the similar languages do.
> 
> According to <http://www.perl.com/pub/a/2002/10/01/hashes.html>, the 
> algorithm Memcached.pm uses is the one Perl 5.005 used, but it changed 
> with 5.61, IIRC. I don't know of any way to use it yourself, however.
> 
> Speaking of similar languages, Ruby exposes its hashing function as the 
> 'hash' method of the Object class, so the Ruby client lib for memcache 
> I've been working on by default just does the equivalent of:
> 
>    key.hash % buckets.nitems
> 
> --
> Michael Granger <ged@FaerieMUD.org>
> Rubymage, Architect, Believer
> The FaerieMUD Consortium <http://www.FaerieMUD.org/>
>