<p>I was also very interested in this, so i forked the repo from theoplampert and added some extra features. You can find it here, <a href="https://github.com/jacobnijgh/ElementAPI" rel="nofollow">https://github.com/jacobnijgh/ElementAPI</a>. 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.</p>

CC BY-SA 3.0
2015-12-11T12:53:19.077Z
2015-12-11T12:53:19.077Z
Jacob
<p>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 <code>cache</code> and <code>cacheTime</code>:
<a href="https://github.com/theolampert/ElementAPI" rel="nofollow noreferrer">https://github.com/theolampert/ElementAPI</a></p>

<p><strong>Update</strong>: They have introduced a new <a href="https://github.com/craftcms/element-api/tree/v1#cache" rel="nofollow noreferrer"><code>cache</code></a> option in the official <a href="https://github.com/craftcms/element-api/tree/v1" rel="nofollow noreferrer">ElementAPI</a> plugin (version 1.5).</p>

CC BY-SA 3.0
2016-07-22T18:13:55.663Z
Any tips how to bust the cache? For either of these forks?
Steve Mock
CC BY-SA 3.0
2016-07-24T18:57:03.233Z
use `craft->cache->delete('routename')`
oncode
CC BY-SA 3.0
2015-10-15T15:50:10.240Z
2017-05-24T22:39:30.997Z
2017-05-24T22:39:30.997Z
oncode
<p>I'm replacing some templates with the ElementAPI plugin.</p>

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

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

CC BY-SA 3.0
2015-09-22T12:55:20.650Z
I'm also interested in this. Anyone have any insight?
Peter Tell
<cache><plugin-elementapi>
How do I cache with the ElementAPI plugin?
# How do I cache with the ElementAPI plugin?

(Asked by: username_0 on 2015-09-15)

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?

**Tags:** cache, plugin-elementapi
> **Comments:**
> **username_1**: I'm also interested in this. Anyone have any insight?  

---

## 2 answers

### Answer by username_3 on 2015-10-15. Score: 8 | Accepted answer

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`](https://github.com/craftcms/element-api/tree/v1#cache) option in the official [ElementAPI](https://github.com/craftcms/element-api/tree/v1) plugin (version 1.5).

> **Comments:**
> **username_4**: Any tips how to bust the cache? For either of these forks?  
> **username_3**: use `craft->cache->delete('routename')`  

---

### Answer by username_2 on 2015-12-11. Score: 4

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.


---

