App-derived

 view release on metacpan or  search on metacpan

lib/App/derived/Plugin/Memcached.pm  view on Meta::CPAN

            and return $ret;
    }
    unless ((! defined($ret)
                 && ($! == EINTR || $! == EAGAIN || $! == EWOULDBLOCK))) {
        return;
    }
    # wait for data
 DO_SELECT:
    while (1) {
        my ($rfd, $wfd);
        my $efd = '';
        vec($efd, fileno($sock), 1) = 1;
        if ($is_write) {
            ($rfd, $wfd) = ('', $efd);
        } else {
            ($rfd, $wfd) = ($efd, '');
        }
        my $start_at = time;
        my $nfound = select($rfd, $wfd, $efd, $timeout);
        $timeout -= (time - $start_at);
        last if $nfound;
        return if $timeout <= 0;
    }
    goto DO_READWRITE;
}

1;


__END__

=encoding utf8

=head1 NAME

App::derived::Plugin::Memcached - memcached-protocol server for derived

=head1 SYNOPSIS

  $ derived -MMemcahced,port=12306 CmdsFile

=head1 DESCRIPTION

This plugin has a memcached-protocol server. You can get some status from 
any memcached client.

=head1 ARGUMENTS

=over 4

=item port:Int

Port number to bind

=item host:String

Host name or Address to bind

=item timeout:Int

Timeout seconds to read request. default 10.

=back

=head1 CLIENT SAMPLE

You can access to data by any memcached client.

  use Cache::Memcached::Fast;

  my $memcached = Cache::Memcached::Fast->new({
    servers => [qw/localhost:12306/],
  });

  say $memcached->get('slowqueris'); # only per seconds value.
  say $memcached->get('slowqueris:latest'); # only latest value.
  say $memcached->get('slowqueris:full'); #JSON formated data include raw values
  
=head1 SEE ALSO

<drived>, <App::derived::Plugin> for writing plugins

=head1 AUTHOR

Masahiro Nagano E<lt>kazeburo@gmail.comE<gt>

=head1 LICENSE

Copyright (C) Masahiro Nagano

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.483 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )