Beekeeper::Worker::Extension::SharedCache - Locally mirrored shared cache
Version 0.09
use Beekeeper::Worker::Extension::SharedCache; my $c = $self->shared_cache( id => "mycache", max_age => 300, persist => 1, ); $c->set( $key => $value ); $c->get( $key ); $c->delete( $key ); $c->touch( $key );
This extension implements a locally mirrored shared cache: each worker keeps a copy of all cached data, and all copies are synced through the message bus.
Access operations are essentially free, as data is held locally. But changes are expensive as they need to be propagated to every worker, and overall memory usage is high due to data cloning.
Keep in mind that retrieved data may be stale due to latency in the propagation of changes through the bus which involves two MQTT messages.
Due to propagation costs this cache does not scale very well. The limiting factor is the global rate of updates, which will cap around 5000 operations per second.
Thus this cache is suitable only for small data sets that do not change very often.
José Micó, jose.mico@gmail.com
jose.mico@gmail.com
Copyright 2015-2021 José Micó.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language itself.
This software is distributed in the hope that it will be useful, but it is provided “as is” and without any express or implied warranties. For details, see the full text of the license in the file LICENSE.
To install Beekeeper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Beekeeper
CPAN shell
perl -MCPAN -e shell install Beekeeper
For more information on module installation, please visit the detailed CPAN module installation guide.