OK that seems to work:
<%attr>
ajax => 1
</%attr>
<%init>
my $result = $m->cache->get('test_key');
if (!defined($result)) {
$result=time();
$m->cache->set('test_key', $result);
}
# return if $m->cache_self(key => 'ljs-loadablejs' . $session{username} .
$session{userType}, expires_in => '3 hours' );
</%init>
<pre>
=====================================================================================
REAL: <% time() %>
CACHED: <% $result %>
=====================================================================================
</pre>
Now what?
On Jun 9, 2010, at 4:33 PM, Jonathan Swartz wrote:
> Try reducing your example to a more minimal one. e.g. Use regular $m->cache
> instead of $m->cache_self, and try just caching a single static key and value
> to see if that works. Also try dumping the contents of $m->cache.
>
> On Jun 9, 2010, at 1:26 PM, tech_list wrote:
>
>> I can't seem to get cache to work.
>>
>>
>>
>> example component:
>>
>> <%attr>
>> ajax => 1
>> </%attr>
>> <%init>
>>
>>
>> return if $m->cache_self(key => 'ljs-loadablejs' . $session{username} .
>> $session{userType}, expires_in => '3 hours' );
>>
>> </%init>
>> <pre>
>> =====================================================================================
>> <% time() %>
>> =====================================================================================
>> </pre>
>>
>>
>> from httpd:
>>
>> PerlSetVar MasonDataDir /var/spool/mason/[site].com
>> PerlAddVar MasonDataCacheApi chi
>> PerlAddVar MasonDataCacheDefaults "driver => FastMmap"
>> #PerlSetVar MasonCodeCacheMaxSize 0
>>
>> Each time it gives me the current time instead of the cached verison
>> ------------------------------------------------------------------------------
>> ThinkGeek and WIRED's GeekDad team up for the Ultimate
>> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
>> lucky parental unit. See the prize list and enter to win:
>> http://p.sf.net/sfu/thinkgeek-promo
>> _______________________________________________
>> Mason-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/mason-users
>
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users