Cache-Memcached-Fast

 view release on metacpan or  search on metacpan

lib/Cache/Memcached/Fast.pm  view on Meta::CPAN

to connect to this particular server for another I<failure_timeout>
seconds.  Value of zero disables this behaviour.

=item I<failure_timeout>

  failure_timeout => 30
  (default: 10 seconds)

The value is a positive integer number of seconds.  See
L</max_failures>.

=item I<ketama_points>

  ketama_points => 150
  (default: 0)

The value is a non-negative integer.  When positive, enables the
B<Ketama> consistent hashing algorithm
(L<http://www.last.fm/user/RJ/journal/2007/04/10/392555/>), and
specifies the number of points the server with weight 1 will be mapped
to.  Thus each server will be mapped to S<I<ketama_points> *
I<weight>> points in continuum.  Larger value will result in more
uniform distribution.  Note that the number of internal bucket
structures, and hence memory consumption, will be proportional to sum
of such products.  But bucket structures themselves are small (two
integers each), so you probably shouldn't worry.

Zero value disables the Ketama algorithm.  See also server weight in
L</servers> above.

=item I<serialize_methods>

  serialize_methods => [ \&Storable::freeze, \&Storable::thaw ],
  (default: [ \&Storable::nfreeze, \&Storable::thaw ])

The value is a reference to an array holding two code references for
serialization and deserialization routines respectively.

Serialization routine is called when the I<$value> passed to L</set>
method family is a reference.  The fact that serialization was
performed is remembered along with the data, and deserialization
routine is called on data retrieval with L</get> method family.  The
interface of these routines should be the same as for
L<Storable::nfreeze|Storable/nfreeze> and
L<Storable::thaw|Storable/thaw>.  I.e. serialization routine takes a
reference and returns a scalar string; it should not fail.
Deserialization routine takes scalar string and returns a reference;
if deserialization fails (say, wrong data format) it should throw an
exception (call I<die>).  The exception will be caught by the module
and L</get> will then pretend that the key hasn't been found.

=item I<utf8>

  utf8 => 1
  (default: disabled)

The value is a boolean which enables (true) or disables (false) the
conversion of Perl character strings to octet sequences in UTF-8
encoding on store, and the reverse conversion on fetch (when the
retrieved data is marked as being UTF-8 octet sequence).  See
L<perlunicode|perlunicode>.

=item I<max_size>

  max_size => 512 * 1024
  (default: 1024 * 1024)

The value is a maximum size of an item to be stored in memcached.
When trying to set a key to a value longer than I<max_size> bytes
(after serialization and compression) nothing is sent to the server,
and I<set> methods return I<undef>.

Note that the real maximum on the server is less than 1MB, and depends
on key length among other things.  So some values in the range
S<I<[1MB - N bytes, 1MB]>>, where N is several hundreds, will still be
sent to the server, and rejected there.  You may set I<max_size> to a
smaller value to avoid this.

=item I<check_args>

  check_args => 'skip'
  (default: not 'skip')

The value is a string.  Currently the only recognized string is
I<'skip'>.

By default all constructor parameter names are checked to be
recognized, and a warning is given for unknown parameter.  This will
catch spelling errors that otherwise might go unnoticed.

When set to I<'skip'>, the check will be bypassed.  This may be
desired when you share the same argument hash among different client
versions, or among different clients.

=back

=back

=head1 METHODS

=over

=item C<enable_compress>

  $memd->enable_compress($enable);

Enable compression when boolean I<$enable> is true, disable when
false.

Note that you can enable compression only when you set
L</compress_threshold> to some positive value and L</compress_methods>
is set.

I<Return:> none.

=item C<namespace>

  $memd->namespace;
  $memd->namespace($string);

Without the argument return the current namespace prefix.  With the



( run in 1.811 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )