Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Catalyst-View-Xslate CPAN distribution.

Report information
The Basics
Id: 99867
Status: open
Priority: 0/
Queue: Catalyst-View-Xslate

People
Owner: Nobody in particular
Requestors: bluefeet [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: cache=>2 and preload=>1 has issues
Date: Tue, 28 Oct 2014 12:11:00 -0700
To: bug-Catalyst-View-Xslate [...] rt.cpan.org
From: Aran Deltac <bluefeet [...] gmail.com>
When cache=>2 Xslate will never refresh the cache, even when preload=>1. I would think a common production configuration is to preload the cache (preload=>1), but then never try to refresh it from that point forward (cache=>2). Currently cache=>2 pretty much invalidates preload except for the first time, when the cache is empty. I've worked around this in my view subclass with something like the below. What I'm doing is detecting the situation where cache=>2 and preload=>1. If that happens I set cache=>1 (causing the cache to be refreshed as part of preload) and then after the preload I set cache=>2, forcing the xslate object to be rebuilt. I'm thinking that Catalyst::View::Xslate should have built-in smarts about this. has _preload_cache_fix => ( is => 'ro', isa => 'Bool', ); around BUILDARGS => sub{ my $orig = shift; my $class = shift; my $args = $class->$orig( @_ ); if ($args->{preload} and $args->{cache} == 2) { $args->{cache} = 1; $args->{_preload_cache_fix} = 1; } return $args; }; after preload_templates => sub{ my ($self) = @_; if ($self->_preload_cache_fix()) { $self->cache( 2 ); $self->xslate(); } return; };
Sounds like a Text::Xslate issue, no?