in reply to Re: What does the hash key, global => 1, do in CHI
in thread What does the hash key, global => 1, do in CHI

Hi Fletch,

Thanks for the quick response. I used $cache = CHI->new( driver => 'Memory', global => 1 ); as an example
to show how 'global => 1' was being used. I am not instantiating the CHI class that way. Actually, I am using:

my $cache = CHI->new( driver => 'File', root_dir => '/path/to/my_cache_dir' );

The documentation does not show the use of 'global => 1' with that example. I was curious why and when it is necessary to use it.

Replies are listed 'Best First'.
Re^3: What does the hash key, global => 1, do in CHI
by Fletch (Bishop) on May 20, 2021 at 16:26 UTC

    global is an argument specifically for the "Memory" (CHI::Driver::Memory) driver. If you're using a different driver then you'd consult the documentation for the custom options that particular implementer uses (i.e. CHI::Driver::File for the relevant options for that module).

    Edit: Just to expound on this, the docs for CHI show the common constructor options that are available irrespective(*) of the driver being used; anything specific to a given driver module would be documented with the driver module.

    (*) I'm not really familiar with CHI so conceivably there could be some options that are incompatible with some drivers but I'm not aware if that's actually the case; the documentation for the individual drivers would say for sure were that the case.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.