Quote from: jrotering at Jun 27, 2012, 09:37 AMBy "cannot be cached", do you mean "must not be cached if you want it all to work as expected?" Or do you mean "the system will ignore caching directives and will always process as uncached?" I'm 99.5% sure you mean the former, but this is pretty important for me to be 100% sure about.
I mean the former; if you use such items cached on a Resource, the first user to access it will determine what gets cached and affect all future visitors' results to the Resource.
Quote from: jrotering at Jun 27, 2012, 09:51 AMRegarding your second paragraph, let me see if I understand you correctly. I think you are suggesting that I:
- use an uncached snippet that is itself not restricted in any way by Access Permissions (is not in an element group that has front-end restrictions)
- Within the snippet logic, explicitly check whether the user has the authority to view the restricted element group
- If so, return the expected chunk.
Yes, except I would not use Access Permissions for the restrictions here, if that's what you are suggesting with "restricted element group". Check what "category" it's in maybe and keep it simple?
Quote from: jrotering at Jun 27, 2012, 09:51 AMAlso, when you say "Then you can cache the individual Chunks, since they will only get included in the output based on the Snippet logic."... how exactly does that work. I'm a little foggy on the concept of cached/uncached when it comes to the chunk that is returned by a snippet. If I call getObject or getChunk in my return statement, is that cached or uncached by default? (I've never even considered this... I guess I always assumed if I was getting a chunk via an API call, I was getting it uncached).
Actually, you are correct, it will not get cached since it would not be parsed until after non-cacheable processing is started. I was thinking both would get cached by tag signature, but this is not the case.
That said, if you know the user accessing the Resource in your Snippet which decides which Chunk to include, you can have that Snippet simply grab cached output from the first execution by that specific user; just create a key that is unique to the user and the Snippet and you can bypass the getChunk() after the user accesses that Resource the first time.