1
0
Fork 0
mirror of https://github.com/perlbot/perlbuut synced 2025-06-07 16:35:40 -04:00
perlbuut/plugins/cache_check.pm
2009-12-05 00:02:04 -05:00

37 lines
619 B
Perl

package Bot::BB3::Plugin::CacheCheck;
use strict;
sub new {
my( $class ) = @_;
my $self = bless {}, $class;
$self->{name} = "cache_check";
$self->{opts} = {
command => 1,
};
return $self;
}
sub initialize {
my( $self, $pm, $cache ) = @_;
die "Failed to receive a cache during initialization: $cache"
unless $cache;
$self->{cache} = $cache;
}
sub command {
my( $self, $said, $pm ) = @_;
my $cache = $self->{cache};
my $key = "cache_check_counter";
$cache->set( $key => ( $cache->get( $key ) + 1 ) );
return( 'handled', "Counter: " . $cache->get( $key ) );
}
"Bot::BB3::Plugin::CacheCheck";