I'm replacing some templates with the ElementAPI plugin.

In my templates, I would use the cache tag, and rely on Craft to handle invalidation when the elements changed.

How can I achieve a similar thing now that I'm using the ElementAPI plugin?

  • I'm also interested in this. Anyone have any insight?
    – Peter Tell
    Sep 22, 2015 at 12:55

2 Answers 2


The ElementAPI plugin itself doesn't seem to offer a caching solution, but there is a fork from a guy which has implemented a caching option cache and cacheTime: https://github.com/theolampert/ElementAPI

Update: They have introduced a new cache option in the official ElementAPI plugin (version 1.5).

  • Any tips how to bust the cache? For either of these forks?
    – Steve Mock
    Jul 22, 2016 at 18:13
  • use craft->cache->delete('routename')
    – oncode
    Jul 24, 2016 at 18:57

I was also very interested in this, so i forked the repo from theoplampert and added some extra features. You can find it here, https://github.com/jacobnijgh/ElementAPI. This fork allows you to not only cache the results but also the paginated results just what we needed in our case for loading some results with AJAX.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.