sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Justin Edelson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SLING-7203) Sling Model Request-Scoped Caching Not Effective Across Script Include Boundaries
Date Tue, 17 Oct 2017 14:44:00 GMT

    [ https://issues.apache.org/jira/browse/SLING-7203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16207730#comment-16207730
] 

Justin Edelson commented on SLING-7203:
---------------------------------------

One thing which could work would be to unwind the request in the {{ModelAdapterFactory}} *only*
for use as the cache key.

> Sling Model Request-Scoped Caching Not Effective Across Script Include Boundaries
> ---------------------------------------------------------------------------------
>
>                 Key: SLING-7203
>                 URL: https://issues.apache.org/jira/browse/SLING-7203
>             Project: Sling
>          Issue Type: Bug
>            Reporter: Justin Edelson
>
> The request-scoped caching added in SLING-6785 does not work correctly across included
boundaries, i.e. if you have a script like
> {code}
> <sly data-sly-resource="${'first' @ resourceType='my/resource/type/first'}"/>
> <sly data-sly-resource="${'second' @ resourceType='my/resource/type/second'}"/>
> {code}
> and both {{first.html}} the request is adapted to some cacheable model object, the adaptation
will happen twice, despite the cache attribute on the {{@Model}} annotation.
> The reason for this is that each script actually has a unique request object, instantiated
by {{ScriptHelper}} (see https://github.com/apache/sling/blob/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/ScriptHelper.java#L100).
> I don't know what a good way to fix this is. One option could be to unwrap the {{SlingHttpServletRequestWrapper}}
in {{SlingModelsUseProvider}}.
> [~kwin] any ideas?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message