Starch::Store::Layered - Layer multiple Starch stores.
my $starch = Starch->new( expires => 2 * 60 * 60, # 2 hours store => { class => '::Layered', outer => { class=>'::CHI', max_expires => 10 * 60, # 10 minutes ..., }, inner => { class=>'::MongoDB', ..., }, }, );
This store provides the ability to declare two stores that act in a layered fashion where all writes (set and remove) are applied to both stores but all reads (get) are attempted, first, on the "outer" store, and if that fails the read is attempted in the "inner" store.
set
remove
get
When get is called, if the outer store did not have the data, but the inner store did, then the data will be automatically written to the outer store.
The most common use-case for this store is for placing a cache in front of a persistent store. Typically caches are much faster than persistent storage engines.
Another use case is for migrating from one store to another. Your new store would be set as the inner store, and your old store would be set as the outer store. Once sufficient time has passed, and the new store has been populated, you could switch to using just the new store.
If you'd like to layer more than two stores you can use layered stores within layered stores.
This is the outer store, the one that tries to handle read requests first before falling back to the "inner" store.
Accepts the same value as "store" in Starch::Manager.
This is the inner store, the one that only handles read requests if the "outer" store was unable to.
Return true if either the "inner" or "outer" stores support the "reap_expired" in Starch::Store method.
Calls "reap_expired" in Starch::Store on the "outer" and "inner" stores, if they support expired state reaping.
Set "set" in Starch::Store.
Set "get" in Starch::Store.
Set "remove" in Starch::Store.
See "AUTHOR" in Starch, "CONTRIBUTORS" in Starch, and "LICENSE" in Starch.
To install Starch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Starch
CPAN shell
perl -MCPAN -e shell install Starch
For more information on module installation, please visit the detailed CPAN module installation guide.