You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried using redis caching for a route that renders a simple view. I have caching working generally with the basic request.reply({ 'greeting': 'hello world' }) style response.
When I attempt a similarly simple test with a rendered Handlebars view I get all normal caching behavior (set / get / expiry) but an empty payload, e.g.,
The problem is that caching is currently performed around the handler only. View and directory rendering happens before transmission. This is causing empty content to be cached. For now, I just removed directory and view from being cacheable. Long term solution will require a lot more effort to figure out what's the right way to accomplish this.
One problem with early rendering of view responses is that it is very common to inject additional values into the view context in onPreResponse. It is also common to add user-specific information. There is no simple solution here as it changes based on the use case.
Perhaps it would make sense to only cache the template name, context and options for the view, then use the cached payload to re-generate the view, with onPreResponse getting data virtually identical to what it would for an un-cached response?
I've tried using redis caching for a route that renders a simple view. I have caching working generally with the basic request.reply({ 'greeting': 'hello world' }) style response.
When I attempt a similarly simple test with a rendered Handlebars view I get all normal caching behavior (set / get / expiry) but an empty payload, e.g.,
I've tried all the documented forms for generating a view, with the same results.
Is this a bug, or am I missing something?
-- Here's my view rendering code --
The text was updated successfully, but these errors were encountered: