- OPTIONAL MANAGER ARGUMENTS
- COPYRIGHT AND LICENSE
Starch::Plugin::RenewExpiration - Trigger periodic writes to the store.
my $starch = Starch->new( plugins => ['::RenewExpiration'], renew_threshold => 10 * 60, # 10 minutes ..., );
If your state is used for reading more than writing you may find that your states expire in the store when they are still being used since your code has not triggered a write of the state data by changing it.
This plugin causes "save" in Starch::State to save even if the state data is not dirty (normally it would just silently return). Typically you'll want to set the "renew_threshold" argument so that this write only happens after the state has gotten a little stale rather than on every time it is used.
These arguments are added to the Starch::Manager class.
How long to wait, since the last state write, before forcing save to write to the store.
Defaults to zero which will renew the expiration every time save is called.
In order to avoid multiple simultaneous requests from trying to renew an expiration at the same time, stampeding the store, you can set this attribute to add some randomness to the "renew_threshold" check.
This must be a ratio between
0.5 and a
60 would cause the expiration to be renewed somewhere between
60 seconds after it was last modified.
0.0 which means there will be no variance.
See "SUPPORT" in Starch.
See "AUTHORS" in Starch.