# Flush pages cache

**URL:** <https://forum.getkirby.com/t/flush-pages-cache/15596>\
**Category:** Questions\
**Tags:** v3\
**Created:** [September 11, 2019, 1:42pm UTC](https://forum.getkirby.com/t/flush-pages-cache/15596 "2019-09-11T13:42:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![bvdputte](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bvdputte/32/8179_2.png) [@bvdputte](https://forum.getkirby.com/u/bvdputte)\
**Post date:** [September 11, 2019, 1:42pm UTC](https://forum.getkirby.com/t/flush-pages-cache/15596/1 "2019-09-11T13:42:10Z")

</div>

How do I flush the `pages` cache in Kirby 3? It is enabled in the `config.php`:

```auto
'pages' => [
  'active' => true,
  'ignore' => ["contact", "search"]
]

```

I’ld need it in a route.

I’ve tried `$kirby->cache('pages')->flush()`, but that isn’t doing much?

Thx!

---

<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:** [September 11, 2019, 3:05pm UTC](https://forum.getkirby.com/t/flush-pages-cache/15596/2 "2019-09-11T15:05:46Z")

</div>

> [@bvdputte](#):
>
> ‘pages’ =\> [‘active’ =\> true, ‘ignore’ =\> [“contact”, “search”] ]

That should work, provided you have defined `$kirby` before, otherwise use `kirby()->cache('pages')->flush()`

---

<div class="post-metadata">

**Author:** ![bvdputte](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bvdputte/32/8179_2.png) [@bvdputte](https://forum.getkirby.com/u/bvdputte)\
**Post date:** [September 11, 2019, 4:14pm UTC](https://forum.getkirby.com/t/flush-pages-cache/15596/3 "2019-09-11T16:14:19Z")

</div>

I’m not getting errors, but the cache ain’t flushed either 🤔.

---

<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:** [September 11, 2019, 5:09pm UTC](https://forum.getkirby.com/t/flush-pages-cache/15596/4 "2019-09-11T17:09:33Z")

</div>

Hm, got to test this. In a template, the above code works as expected.

---

<div class="post-metadata">

**Author:** ![Philip](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/philip/32/6480_2.png) [@Philip](https://forum.getkirby.com/u/Philip)\
**Post date:** [September 11, 2019, 5:53pm UTC](https://forum.getkirby.com/t/flush-pages-cache/15596/5 "2019-09-11T17:53:05Z")

</div>

I am not sure if its wrong to “hijack” this thread but I was about to ask a similar question. Is it possible flush the cache (the cache folder inside “site”) on deployment for example? Any scripts or command line tools?

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:** [September 11, 2019, 6:19pm UTC](https://forum.getkirby.com/t/flush-pages-cache/15596/6 "2019-09-11T18:19:40Z")

</div>

@bvdputte Could you please post your code, flushing the cache works for me, although the route itself returns an error in my quick and dirty test.

@Philip If you flush the pages cache, only the pages cache folders are cleared. But you can, of course, also flush the other caches, including via script.

However, depending on how you deploy, this might not be necessary, because if you deploy via git or rsync, you could exclude the files for your deployment process.

---

<div class="post-metadata">

**Author:** ![Philip](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/philip/32/6480_2.png) [@Philip](https://forum.getkirby.com/u/Philip)\
**Post date:** [September 11, 2019, 8:45pm UTC](https://forum.getkirby.com/t/flush-pages-cache/15596/7 "2019-09-11T20:45:19Z")

</div>

@texnixe Thanks for quick reply. I get your point about the gitignore however my concern is that if I change something in the template locally and push to git and then deploy to server how would I go about making sure the cache is flushed/cleared?

I assume html markup is cached despite the cache is not creating a 100% static html file per page.

---

<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:** [September 11, 2019, 8:49pm UTC](https://forum.getkirby.com/t/flush-pages-cache/15596/8 "2019-09-11T20:49:26Z")

</div>

@Philip Well, if you deploy manually like pushing your files over via SFTP, then you have to also manually clear the cache folder.

If you deploy with git, you can use a git hook to clear the folder.

With an rsync workflow, you could make it part of your script (@jimbobrjames is our rsync expert)

---

<div class="post-metadata">

**Author:** ![bvdputte](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bvdputte/32/8179_2.png) [@bvdputte](https://forum.getkirby.com/u/bvdputte)\
**Post date:** [September 12, 2019, 8:18am UTC](https://forum.getkirby.com/t/flush-pages-cache/15596/9 "2019-09-12T08:18:46Z")

</div>

Nevermind @texnixe, I made an error 🙈. The code works as expected, obviously.

Thx!
