Starch::Plugin::TimeoutStore - Throw an exception if store access surpasses a timeout.
my $starch = Starch->new( plugins => ['::TimeoutStore'], store => { class => '::Memory', timeout => 0.1, # 1/10th of a second }, ..., );
This plugin causes all calls to set, get, and remove to throw an exception if they surpass a timeout period.
set
get
remove
The timeout is implemented using Sys::SigAction.
Note that some stores implement timeouts themselves and their native may be better than this naive implementation.
The whole point of detecting timeouts is so that you can still serve a web page even if the underlying store backend is failing, so using this plugin with Starch::Plugin::LogStoreExceptions is probably a good idea.
These arguments are added to classes which consume the Starch::Store role.
How many seconds to timeout. Fractional seconds may be passed, but may not be supported on all systems (see "ABSTRACT" in Sys::SigAction). Set to 0 to disable timeout checking. Defaults to 0.
0
Aran Clary Deltac <bluefeet@gmail.com>
Thanks to ZipRecruiter for encouraging their employees to contribute back to the open source ecosystem. Without their dedication to quality software development this distribution would not exist.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Starch::Plugin::TimeoutStore, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Starch::Plugin::TimeoutStore
CPAN shell
perl -MCPAN -e shell install Starch::Plugin::TimeoutStore
For more information on module installation, please visit the detailed CPAN module installation guide.