# Cache virtually generated json

**URL:** <https://forum.getkirby.com/t/cache-virtually-generated-json/17553>\
**Category:** Questions\
**Tags:** v2\
**Created:** [March 9, 2020, 4:28pm UTC](https://forum.getkirby.com/t/cache-virtually-generated-json/17553 "2020-03-09T16:28:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![illycz](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/illycz/32/5190_2.png) [@illycz](https://forum.getkirby.com/u/illycz)\
**Post date:** [March 9, 2020, 4:28pm UTC](https://forum.getkirby.com/t/cache-virtually-generated-json/17553/1 "2020-03-09T16:28:12Z")

</div>

I’m using route for generating json api. Is it possible cache this generated json file until the panel update? I’m using `return response::json();`

Thanks

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [March 9, 2020, 4:36pm UTC](https://forum.getkirby.com/t/cache-virtually-generated-json/17553/2 "2020-03-09T16:36:04Z")

</div>

Yes, it should be possible using the Toolkit’s cache class to set up the cache and clear the cache using hooks.

---

<div class="post-metadata">

**Author:** ![illycz](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/illycz/32/5190_2.png) [@illycz](https://forum.getkirby.com/u/illycz)\
**Post date:** [March 9, 2020, 4:56pm UTC](https://forum.getkirby.com/t/cache-virtually-generated-json/17553/3 "2020-03-09T16:56:07Z")

</div>

Do you know about some snippets or tutorial (like Kirby cookbook) where I can start?  
I’m not a developer.

Thanks

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [March 9, 2020, 5:12pm UTC](https://forum.getkirby.com/t/cache-virtually-generated-json/17553/4 "2020-03-09T17:12:31Z")

</div>

Have a look at how this archived plugin handles this: [https://github.com/distantnative/embed/tree/master/core/lib](https://github.com/distantnative/embed/tree/master/core/lib)

I’m not aware of a recipe.

I’ve also found this old plugin: [https://github.com/samnabi/getcached](https://github.com/samnabi/getcached)

---

<div class="post-metadata">

**Author:** ![illycz](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/illycz/32/5190_2.png) [@illycz](https://forum.getkirby.com/u/illycz)\
**Post date:** [March 13, 2020, 1:06am UTC](https://forum.getkirby.com/t/cache-virtually-generated-json/17553/5 "2020-03-13T01:06:12Z")

</div>

Thanks a lot. getCached helps me solve my problem…

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:22pm UTC](https://forum.getkirby.com/t/cache-virtually-generated-json/17553/6 "2025-02-06T17:22:46Z")

</div>

Archived on February 6, 2025, 5:22pm UTC


