Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update view-caching.md #278

Open
wants to merge 1 commit into
base: v7.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions the-basics/layouts-and-views/views/view-caching.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ component name="general"{
function index(event,rc,prc){

// call some model for data and put into the request collection
// this data will not be cached, the service will still be called for each request
prc.myQuery = getInstance('MyService').getData();
// view with caching parameters
// even if data changes in prc.myQuery, the cached view will be returned
event.setView(
view="general/index",
cache=true,
Expand All @@ -29,6 +31,13 @@ component name="general"{
}
```

If you want the data and view cached, you might consider [event caching](/the-basics/event-handlers/event-caching)






## Purging Views

So now that our views are cached, how do I purge them programmatically? Well, you need to talk to the `template` cache provider and use the clearing methods:
Expand Down