I’m still a newbie but I finally have my app in 3.1 now and want to turn on some event based caches. I created a cache and see it in debug. My question is how do I add this event to a specific cache? I search and can’t find how.
trying something like
function someFunction(event,rc, cache=‘myCacheName’)
{
event.setview("someFunction);
}
the default cache for events and view caching is called “template”
So you would have to alter or create a named cached called “template” and then point it to whatever provider or configuration you like. As far as telling it this event into this named cache, not yet, 3.5
Thanks. I do that. fwreinit, run the page, and check the cache and there are no events cached. I have plugins, handlers, and interceptors cached but no events. Do I need to inject cachebox in 3.1?
The event cache works great but I only want it to cache my view not the entire layout. When I do this my users get confused because I show who is logged into the page and it shows the name of the person who created the cache. Am I doing something wrong? Is there a different way to cache just the view?
Ok, so I thought that would work but this event accepts variables and since it’s caching the view it doesn’t act like the event cache where it considers each event with different variables a different cached object. So I’m back where I started.
When I said “that user only”, I mean session-specific caching.
If you store any user information in the session, you could use that instead of the urltoken I used in my example (which is unique for every user).
So say you set session.userID=0 in you onSessionStart handler (for a public user), then you change that session.userID once someone logs in, every unlogged in (public) user will use the same public cache (for session.userID = 0), and every logged in user will see a cache specific for them only (session.userID = xxx).
OnRequestCapture interception point totally, totally rocks. My pps go like a train now
Or if you want: event.setView(name=”raa”,cache=true,cacheSuffix=hash(serializeJSON([url,form])); (which will ensure view is cached basic on url/form vars
If showing who is logged in is the only issue, I would bake a JavaScript variable into the view that updates the “whos logged in” text once the DOM is ready.