NAME
Starch::Plugin::TimeoutStore - Throw an exception if store access surpass a timeout.
SYNOPSIS
my $starch = Starch->new(
plugins => ['::TimeoutStore'],
store => {
class => '::Memory',
timeout => 0.001, # 1 millisecond
},
...,
);
DESCRIPTION
This plugin causes all calls to set, get, and remove to throw an exception if they surpass a timeout period.
The timeout is implemented using Time::HiRes's alarm function, which takes fractional seconds, and a localized $SIG{ALRM} handler.
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.
Note that this plugin does not behave well on Perl 5.8 or older and will error if you try to use it on a version of Perl older than 5.10. The rest of Starch works well on 5.8 and up.
OPTIONAL STORE ARGUMENTS
These arguments are added to classes which consume the Starch::Store role.
timeout
How many seconds to timeout. Set to 0 to disable timeout checking. Defaults to 0.
AUTHORS AND LICENSE
See "AUTHOR" in Starch, "CONTRIBUTORS" in Starch, and "LICENSE" in Starch.