About collection caching and cache clearing

I used Kirby Cache driver now. I was guessing that Kirby caching collections not pages. I am disappointed. I was expecting collections cache like database query cache. I dont want to cache page, only collections. Page cache well but collection cache should be included also. Possible that?

Q: Why collection cache?
A: I think, collections most important from static pages because of collections filtering, sorting, finding and so much more slowdown. For example: i have skills collection and i am using this collection different pages. When skills are changed, i have forced to clear all pages. If collections cache feature exists, clear only the collection.

Another question that if collection cache is not possible. How can i clear specific page/pages cache?

Any ideas? What do you think?

@bastianallgeier @lukasbestle @texnixe @samnabi @distantnative

Thanks :smile:

New Year Party is over :fireworks: . Let’s talk about :wink:

I am afraid, I just do not get what exactly you mean with all of this. If you change one page, the whole cache is flushed anyway.

I think what @ahmetbora means is: He does NOT want to clear the whole cache if a page is changed, but only the bit of the cache (the collection or collections) that contains the modified page.

Ah okay. The problem I see is that other pages still could reference the updated page. For example, we have home, reviews (as a sibling to home) and review-a (as a child of reviews). Now we edit review-a to correct our movie score we just gave yesterday when we had a drink too much. We realized “The Revenant” is actually not that good.

When we now update this, with the suggested collections-only cached flushing only review-a and reviews would get flushed.

But we actually do have a little info box on home showing our latest reviews in a short summary. By directly referencing other pages:

<?= page('reviews')->children()->first()->score() ?>

Since Kirby cannot be aware of this, home would not be updated and would still show our naive rating which praises Leo way too much for his probably academy-awarded role. We do not want that.

So that’s why I think there is no really save alternative to flushing the whole cache on any change. Other thoughts?

p.s. excuse my way too specific example.

2 Likes

For example with sql on another systems.

Current is cache of views (pages) with hmtl.

Expected is only cache of sql query results (collections)

Kirby 1 had a separate option to enable/disable HTML cache so that only the data would get cached. Does anyone know what happened to that? @distantnative

Nope, I wasn’t really engaged in Kirby 1, only got to know it better when Kirby 2 came along.