-
- 1,118 Posts
Hi,
I have a site where I am using getResources to pull some content into view. I am using RAND to make the items pulled random, currently using the snippet uncached e.g. [[!getResources]], so with every page refresh, a new random set of items are displayed... Great... But....
Is it possible to adapt getResources to set the caching, so that within a session visit, that the RAND call only happens once - e.g. so if I refresh the page, after the first page load, the items remain the same....? Likewise, within the same browsing session, if I move onto another page, then come back to the page where we have the getResources code call - that again, we don't get another random bunch of items, instead, we just render what the first code call got? THEN... on a different session, we make the random call once more to pick the selection for the new session...
Is this possible?
Any ideas how????
Cheers,
dubbs.
-
- 5,888 Posts
maybe you could take the Session - id or store another random value into the current Session
And take that value as a scriptProperty for getCache.
Then wrap the getResources - call with getCache.
-
- 5,888 Posts
I think just adding that as a additional scriptProperty to getCache could work
[[!getCache?
here go all your properties
&dummyproperty=`[[!getSessionID]]`
]]
This should create a different cache-file for each different SessionID
As far, as I know out of my head, getCache uses its properties and the REQUEST to build the hashed cache-filenames