/usr/share/perl5/AnyEvent/Memcached/Hash/WithNext.pm is in libanyevent-memcached-perl 0.06-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | package AnyEvent::Memcached::Hash::WithNext;
=head1 NAME
AnyEvent::Memcached::Hash::WithNext - Hashing algorythm for AE::Memcached
=head1 SYNOPSIS
my $memd = AnyEvent::Memcached->new(
servers => [ "10.0.0.15:10001", "10.0.0.15:10002", "10.0.0.15:10003" ],
# ...
hasher => 'AnyEvent::Memcached::Hash::WithNext',
);
$memd->set(key => "val", ...) # will put key on 2 servers
=head1 DESCRIPTION
Uses the same hashing, as default, but always put key to server, next after chosen. Result is twice-replicated data. Useful for usage with memcachdb
=cut
use common::sense 2;m{
use strict;
use warnings;
}x;
use Carp;
use base 'AnyEvent::Memcached::Hash';
sub peers {
my $self = shift;
my ($hash,$real,$peers) = @_;
$peers ||= {};
my $peer = $self->{buckets}->peer( $hash );
my $next = $self->{buckets}->next( $peer );
push @{ $peers->{$peer} ||= [] }, $real;
push @{ $peers->{$next} ||= [] }, $real;
return $peers;
}
=head1 AUTHOR
Mons Anderson, C<< <mons at cpan.org> >>
=cut
1;
|