@@ -48,6 +48,7 @@ sub new {
48
48
49
49
$self -> set_servers($args -> {' servers' });
50
50
$self -> {' debug' } = $args -> {' debug' };
51
+ $self -> {' no_rehash' } = $args -> {' no_rehash' };
51
52
$self -> {' stats' } = {};
52
53
$self -> {' compress_threshold' } = $args -> {' compress_threshold' };
53
54
$self -> {' compress_enable' } = 1;
@@ -75,6 +76,11 @@ sub set_debug {
75
76
$self -> {' debug' } = $dbg ;
76
77
}
77
78
79
+ sub set_norehash {
80
+ my ($self , $val ) = @_ ;
81
+ $self -> {' no_rehash' } = $val ;
82
+ }
83
+
78
84
sub set_compress_threshold {
79
85
my ($self , $thresh ) = @_ ;
80
86
$self -> {' compress_threshold' } = $thresh ;
@@ -189,6 +195,7 @@ sub get_sock { # (key)
189
195
my $host = $self -> {' buckets' }-> [$hv % $self -> {' bucketcount' }];
190
196
my $sock = sock_to_host($host );
191
197
return $sock if $sock ;
198
+ return undef if $sock -> {' no_rehash' };
192
199
$hv += _hashfunc($tries . $real_key ); # stupid, but works
193
200
}
194
201
return undef ;
@@ -550,6 +557,10 @@ Use C<compress_threshold> to set a compression threshold, in bytes.
550
557
Values larger than this threshold will be compressed by C<set > and
551
558
decompressed by C<get > .
552
559
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
+
553
564
The other useful key is C<debug > , which when set to true will produce
554
565
diagnostics on STDERR.
555
566
@@ -569,6 +580,10 @@ constructor.
569
580
570
581
Sets the C<debug > flag. See C<new > constructor for more information.
571
582
583
+ =item C<set_norehash >
584
+
585
+ Sets the C<no_rehash > flag. See C<new > constructor for more information.
586
+
572
587
=item C<set_compress_threshold >
573
588
574
589
Sets the compression threshold. See C<new > constructor for more information.
0 commit comments