Starch::Store::CHI - Starch storage backend using CHI.
my $starch = Starch->new( store => { class => '::CHI', chi => { driver => 'File', root_dir => '/path/to/root', }, }, ..., );
This Starch store uses CHI to set and get state data.
By default CHI will catch errors and log them using Log::Any and keep on going as if nothing went wrong. In Starch, stores are expected to loudly throw exceptions, so it is suggested that you specify these arguments to your CHI driver:
on_get_error => 'die', on_set_error => 'die',
And then, if you still want the errors logged, you can use Starch::Plugin::LogStoreExceptions. This is especially important if you are using the Starch::Plugin::TimeoutStore plugin which will throw an exception when the timeout is exceeded which then CHI will catch and log by default, which is not what you want.
When using CHI there are various choices you need to make:
Which backend to use? If data persistence is not an issue, or you're using CHI as your outer store in Starch::Store::Layered then Memcached or Redis are common solutions which have high performance.
Which serializer to use? Nowadays Sereal is the serialization performance heavyweight, with JSON::XS coming up a close second.
Which driver to use? Some backends have more than one driver, and some drivers perform better than others. The most common example of this is Memcached which has three drivers which can be used with CHI.
Make sure you ask these questions when you implement CHI for Starch, and take the time to answer them well. It can make a big difference.
This must be set to either hash ref arguments for CHI or a pre-built CHI object (often retrieved using a method proxy).
When configuring Starch from static configuration files using a method proxy is a good way to link your existing CHI object constructor in with Starch so that starch doesn't build its own.
Set "set" in Starch::Store.
Set "get" in Starch::Store.
Set "remove" in Starch::Store.
Please submit bugs and feature requests to the Starch-Store-CHI GitHub issue tracker:
https://github.com/bluefeet/Starch-Store-CHI/issues
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::Store::CHI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Starch::Store::CHI
CPAN shell
perl -MCPAN -e shell install Starch::Store::CHI
For more information on module installation, please visit the detailed CPAN module installation guide.