Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

How to use Cache for REST API data?


Go to End


701 Views

Avatar
VPull

Community Member, 58 Posts

25 September 2017 at 8:11pm

Hello all, sorry if this is duplicate question.
I wanted to cache api data for improve load time and I also read document Partial Caching.
But I am quite confused with how to apply these steps for data which is return by the api.

I tried with default example in my Result.ss include.

<% cached %>
<% loop $SearchResult %>
<div class="item">
    <h2>$Title</h2>
    <p>$StartDate</p>
    <p>$Description</p>
</div>
<% end_loop %>
<% end_cached %>

which also store cache on first load but when I try to submit ajax filter form It shows the same record.