Net-Async-Redis

 view release on metacpan or  search on metacpan

lib/Net/Async/Redis/Commands.pm  view on Meta::CPAN

    'UNLINK' => 1,
    'WATCH' => 1,
    'XACK' => 1,
    'XADD' => 1,
    'XAUTOCLAIM' => 1,
    'XCLAIM' => 1,
    'XDEL' => 1,
    'XGROUP' => 2,
    'XGROUP CREATE' => 2,
    'XGROUP CREATECONSUMER' => 2,
    'XGROUP DELCONSUMER' => 2,
    'XGROUP DESTROY' => 2,
    'XGROUP SETID' => 2,
    'XINFO' => 2,
    'XINFO CONSUMERS' => 2,
    'XINFO GROUPS' => 2,
    'XINFO STREAM' => 2,
    'XLEN' => 1,
    'XPENDING' => 1,
    'XRANGE' => 1,
    'XREAD' => 3,
    'XREADGROUP' => 5,
    'XREVRANGE' => 1,
    'XSETID' => 1,
    'XTRIM' => 1,
    'ZADD' => 1,
    'ZCARD' => 1,
    'ZCOUNT' => 1,
    'ZDIFF' => 2,
    'ZDIFFSTORE' => 3,
    'ZINCRBY' => 1,
    'ZINTER' => 2,
    'ZINTERCARD' => 2,
    'ZINTERSTORE' => 3,
    'ZLEXCOUNT' => 1,
    'ZMPOP' => 2,
    'ZMSCORE' => 1,
    'ZPOPMAX' => 1,
    'ZPOPMIN' => 1,
    'ZRANDMEMBER' => 1,
    'ZRANGE' => 1,
    'ZRANGEBYLEX' => 1,
    'ZRANGEBYSCORE' => 1,
    'ZRANK' => 1,
    'ZREM' => 1,
    'ZREMRANGEBYLEX' => 1,
    'ZREMRANGEBYRANK' => 1,
    'ZREMRANGEBYSCORE' => 1,
    'ZREVRANGE' => 1,
    'ZREVRANGEBYLEX' => 1,
    'ZREVRANGEBYSCORE' => 1,
    'ZREVRANK' => 1,
    'ZSCAN' => 1,
    'ZSCORE' => 1,
    'ZUNION' => 2,
    'ZUNIONSTORE' => 3,
);

our %COMMAND_DEFINITION;

UNITCHECK {
    %COMMAND_DEFINITION = do {
        my $path = Path::Tiny::path(__DIR__)->parent(3)->child('share/commands.yaml');
        $path = Path::Tiny::path(
            File::ShareDir::dist_file(
                'Net-Async-Redis',
                'commands.yaml'
            )
        ) unless $path->exists;
        YAML::XS::LoadFile("$path")->%*
    };
    { # Populate any methods we don't have yet
        my $class = Object::Pad::MOP::Class->for_class(__PACKAGE__);
        for my $k (sort keys %COMMAND_DEFINITION) {
            my $method = $k =~ s/[\.-]+/_/gr;
            unless(__PACKAGE__->can($method)) {
                $log->tracef('Adding new Redis method [%s] for %s', $method, $k);
                $class->add_method($method => sub ($self, @args) {
                    $self->execute_command(split(/_/, $k) => @args)
                });
            }
        }
    }
}

=head1 METHODS - Bitmap

=head2 bitcount

Count set bits in a string.

=over 4

=item * key

=item * [start end [BYTE|BIT]]

=back

L<https://redis.io/commands/bitcount>

=cut

method bitcount (@args) {
    $self->execute_command(qw(BITCOUNT) => @args)
}

=head2 bitfield

Perform arbitrary bitfield integer operations on strings.

=over 4

=item * key

=item * [GET encoding offset]

=item * [SET encoding offset value]

=item * [INCRBY encoding offset increment]



( run in 1.737 second using v1.01-cache-2.11-cpan-39bf76dae61 )