Joe Landman wrote:
Sounds like a strange question, but I want to know if I can put a complex data structure like a hash in there. Do I need to serialize it first?

Alternatively, if it only handles scalars, that is also useful to know.

Thanks.

Well ... never mind. I figured it out for my self. Short version, the following appears to work nicely:

    my $serialized_menu = $c->cache->get('menu');
    if ($serialized_menu)
      {
       @menu    = @{$serialized_menu};
       $c->log->debug('Root::_get_navbar menu retrieved from cache');
      }
      else
      {
       $c->log->debug('Root::_get_navbar rebuilding menu');

       # rebuild menu
       $c->cache->set('menu',[EMAIL PROTECTED]);
      }

For some reason the manual's

        unless ( ... ) {

        } ...

construct did not work for this case.

--

Joe Landman
[EMAIL PROTECTED]

_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to