Skip to content

Commit e7a1a04

Browse files
author
bradfitz
committed
new no_rehash option. remove it from TODO
git-svn-id: http://code.sixapart.com/svn/memcached/trunk/api/perl@171 b0b603af-a30f-0410-a34e-baf09ae79d0b
1 parent 3a573af commit e7a1a04

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

Memcached.pm

+15
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ sub new {
4848

4949
$self->set_servers($args->{'servers'});
5050
$self->{'debug'} = $args->{'debug'};
51+
$self->{'no_rehash'} = $args->{'no_rehash'};
5152
$self->{'stats'} = {};
5253
$self->{'compress_threshold'} = $args->{'compress_threshold'};
5354
$self->{'compress_enable'} = 1;
@@ -75,6 +76,11 @@ sub set_debug {
7576
$self->{'debug'} = $dbg;
7677
}
7778

79+
sub set_norehash {
80+
my ($self, $val) = @_;
81+
$self->{'no_rehash'} = $val;
82+
}
83+
7884
sub set_compress_threshold {
7985
my ($self, $thresh) = @_;
8086
$self->{'compress_threshold'} = $thresh;
@@ -189,6 +195,7 @@ sub get_sock { # (key)
189195
my $host = $self->{'buckets'}->[$hv % $self->{'bucketcount'}];
190196
my $sock = sock_to_host($host);
191197
return $sock if $sock;
198+
return undef if $sock->{'no_rehash'};
192199
$hv += _hashfunc($tries . $real_key); # stupid, but works
193200
}
194201
return undef;
@@ -550,6 +557,10 @@ Use C<compress_threshold> to set a compression threshold, in bytes.
550557
Values larger than this threshold will be compressed by C<set> and
551558
decompressed by C<get>.
552559
560+
Use C<no_rehash> to disable finding a new memcached server when one
561+
goes down. Your application may or may not need this, depending on
562+
your expirations and key usage.
563+
553564
The other useful key is C<debug>, which when set to true will produce
554565
diagnostics on STDERR.
555566
@@ -569,6 +580,10 @@ constructor.
569580
570581
Sets the C<debug> flag. See C<new> constructor for more information.
571582
583+
=item C<set_norehash>
584+
585+
Sets the C<no_rehash> flag. See C<new> constructor for more information.
586+
572587
=item C<set_compress_threshold>
573588
574589
Sets the compression threshold. See C<new> constructor for more information.

TODO

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
-- provide option to not do remapping, to avoid the "netsplit
2-
problem". (some apps might have a problem with that)
1+
-- jamie's stats patches
2+

0 commit comments

Comments
 (0)