Skip to content
Build Curio classes around CHI.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib/Curio/Role
t
.gitignore
.lvimrc
.mailmap
.travis.yml
Build.PL
Changes
LICENSE
META.json
README.md
cpanfile
minil.toml

README.md

NAME

Curio::Role::CHI - Build Curio classes around CHI.

SYNOPSIS

Create a Curio class:

package MyApp::Service::Cache;

use Curio role => '::CHI';
use strictures 2;

export_function_name 'myapp_cache';

add_key geo_ip => (
    chi => {
        driver => 'Memory',
        global => 0,
    },
);

1;

Then use your new Curio class elsewhere:

use MyApp::Service::Cache qw( myapp_cache );

my $chi = myapp_cache('geo_ip')->chi();

DESCRIPTION

This role provides all the basics for building a Curio class which wraps around CHI.

Fun fact, this "SYNOPSIS" is functionally identical to "SYNOPSIS" in Curio.

ARGUMENTS

chi

my $chi = MyApp::Service::Cache->fetch('geo_ip)->chi();

Holds the CHI object.

If passed as a hash ref of arguments they will be coerced as arguments to construct a new CHI object.

This argument is required.

CACHING

This role sets the "does_caching" in Curio::Factory and "cache_per_process" in Curio::Factory features.

cache_per_process is important to set since there are quite a few CHI drivers which fail if re-used across processes.

You can of course disable these features.

does_caching 0;
cache_per_process 0;

SUPPORT

Please submit bugs and feature requests to the Curio-Role-CHI GitHub issue tracker:

https://github.com/bluefeet/Curio-Role-CHI/issues

ACKNOWLEDGEMENTS

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.

AUTHORS

Aran Clary Deltac <bluefeet@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2019 Aran Clary Deltac

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

You can’t perform that action at this time.