hasKey?

christopher at baus.net christopher at baus.net
Sun Feb 6 15:11:12 PST 2005


> What if you stored a key that had a list of keys in it?
>
> in perl, It could be something like
>
> @newlist = qw/b c d/;
> $oldkeys = $memd->get('keylist')
> foreach my $oldkey (@{$oldkeys}) {
>   unless (grep { $_ eq $oldkey } @newlist) {
>     $memd->delete($oldkey);
>   }
> }
> $memd->set('keylist', \@newlist);
>

Hmm.  Not a bad solution for the first iteration.  Have to admit I didn't
think of that.  Maybe it is possible to hack the client to call back after
reading each key element in the value, rather than buffering all the keys
in a vector.

I think I'll try this first, and if it seems like performance will be a 
problem, I'll make some mods...




More information about the memcached mailing list