thanks for the reply, it may be an XY problem :)

Basically I want some data structures to persist in memory between requests. I don't want to write them to a file, a db, memcached etc, because that's somewhat slower and memory will work just fine.

Ideally they'd expire after so long and then I'll reupdate them when I see they've expired. It doesn't matter to me if a module handles the expiration or I do it myself from a time stamp in the structure. The data itself doesn't literally need to be global everywhere, if I can get it from the context that's fine.

Something like Catalyst::Plugin::Cache with Cache::Memory as a backend would work, but from my experimenting it doesn't look like the cache persists between requests :/. Perhaps I am no utilizing it correctly however.

In my application class I merely do

__PACKAGE__->config->{'Plugin::Cache'}{backend} = { + class => "Cache::Memory", default_expires => '600 sec' + };

Then access it via $cache = $c->cache; in my controller. But the data isn't persisting between requests alas

thank you again

In reply to Re^2: Catalyst fcgi engine w. persistent variables by damian45
in thread Catalyst fcgi engine w. persistent variables by damian45

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.