yanick/Dancer-Plugin-Cache-CHI — Issue #8: A namespace for some sites in Dancer
Author: Perlover
Created: 2011-12-05 23:20:19+00:00
State: open

Good day!

I noticed now your example (at below)
I didn't find an opportunity to change a namespace of CHI other than to setup namespace in constructor of CHI
And your example will not work as i think - it only sets up a 'namespace' hash item in Dancer config for your plugin, no more
As you think? I think there no an opportunity to change namespace. And i cannot create some instances of CHI caches from your plugin :(

Your example:

before_create_cache

Called before the creation of the cache, which is lazily done upon its first use.

Useful, for example, to change the cache's configuration at run time:
use Sys::Hostname;

# set the namespace to the current hostname
hook before_create_cache => sub {
config->{plugins}{'Cache::CHI'}{namespace} = hostname;
};