mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-22 03:49:29 +01:00
Dequeue cache events when removing SQLite Storage entries
This commit is contained in:
parent
1f3110075a
commit
d80b70a2e5
@ -167,13 +167,16 @@ sub cache_remove {
|
||||
if (not defined $index2) {
|
||||
# remove index1
|
||||
delete $self->{cache}->{$index1};
|
||||
$self->dequeue_decache($index1, '.*');
|
||||
} else {
|
||||
# remove index2
|
||||
delete $self->{cache}->{$index1}->{$index2};
|
||||
$self->dequeue_decache($index1, $index2);
|
||||
|
||||
# remove index1 if it has no more keys left (aside from _name)
|
||||
if (not grep { $_ ne '_name' } keys %{$self->{cache}->{$index1}}) {
|
||||
delete $self->{cache}->{$index1};
|
||||
$self->dequeue_decache($index1, '.*');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -197,6 +200,12 @@ sub enqueue_decache {
|
||||
);
|
||||
}
|
||||
|
||||
sub dequeue_decache {
|
||||
my ($self, $index1, $index2) = @_;
|
||||
my $key = ($index1 eq '.*' ? 'global' : $index1) . ".$index2";
|
||||
$self->{pbot}->{event_queue}->dequeue("Decache $self->{name} $key");
|
||||
}
|
||||
|
||||
sub create_metadata {
|
||||
my ($self, $columns) = @_;
|
||||
|
||||
|
@ -25,8 +25,8 @@ use PBot::Imports;
|
||||
# These are set by the /misc/update_version script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 4515,
|
||||
BUILD_DATE => "2022-03-17",
|
||||
BUILD_REVISION => 4518,
|
||||
BUILD_DATE => "2022-03-23",
|
||||
};
|
||||
|
||||
sub initialize {}
|
||||
|
Loading…
Reference in New Issue
Block a user