Hi all,
What are the best practices for caching a snippet with some custom data calls?
I'm interested in the caching the output of a custom snippet after some db-calls and data processing stuff. First I've a question about caching details by not using the not-cache flag [[!any]], second I'm interested in the comparison of the cache flag and the use of cacheManager in a snippet.
1.
Does caching using the cache flag at a snippet takes into account arguments? e.g. [[snippet? &arg=`1`]] and [[snippet? &arg=`2`]]. Are these snippet calls cached separately?
2.
Assuming the cache flag takes into account the arguments (as asked in 1.);
Which caching method is better?
- Without the cache flag at the snippet call; [[snippet? &arg=`1`]]. If so, how can I clear this snippet cache when custom objects change?
- With the cache flag, using the cacheManager; [[!snippet? &arg=`1`]] using $modx->cacheManager within the snippet.
I appose option 1 is quicker, because it saves a snippet call including some cache calls, and the cache is saved together with the resource (??).
Thanks in advance!
Huub