Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Custom template resolvers and digest caching. #36

@dasch

Description

@dasch

I'm running into an issue that makes it hard to use Cache Digests in some cases. In the app I'm working on, users can upload custom templates. When these templates are rendered directly as views, Cache Digests works fine -- the template is resolved by a custom resolver, and the template handler injects a cache call that includes the template's digest (computed separately) in the cache key. This trick doesn't work if the custom template is rendered as a partial, as it is assumed that a template does not change at runtime.

I can get around this by disabling caching of digests -- then all templates are loaded and their digests computed. I could even get rid of my custom digest hack that predates Cache Digests. However, this would impact performance.

If Cache Digests included the view path in the cache keys, I think the issue would go away. We could ask each resolver in the path for a cache key and include them in the final cache key. That way, my custom resolver could just check if there have been any changes to the templates since last time and compute a cache key accordingly.

Is this something you would be interested in having in Cache Digests? It feels like it would touch too deeply into Rails, so perhaps it should just go there instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions