Kirby3 Boost - makes loading a lot of pages in one request fast + unique ID

it the content file it says 59651,61 but with boost r/w to false it gets 59628,14?

here is a catch to consider. since boost is using the default kirby caching logic all keys are prefixed with domain. so if your frontend is www.domain.com and your api at api.domain.com you will get invalid results because the api is reading from its cache. and the panel behind www will read another one. and boost has no way of clearing both caches (for now).

i am using regular $page only, no access to the api,

inside the content file:

----

Price: 59638.42

----

screen

boost read/write to FALSE

if i turn it back to TRUE, the Sum will be

59,368.33 € (not correct)

(the prices obviously changes, still overall the calculation seems to be cached somewhere as it’s stuck to the previous screenshots example.

EDIT:

BTW. I addded the models ModelHasBoost

to the product page template, i guess that should be sufficient to get the correct price everywhere using a route?

its really hard to debug this remotely.

i am confident that boost has no major issues here so it must be a semi broken caching state. like boost not setting the modified timestamp when the price changed for some reason.

also boost stores the modified dates of content files only on hooks (by default, can be changed in config)… so if you edit a file in the editor it wont know about that.

please try calling a page->update on the price and vardump the value of the price before and after that. also add vardumps to ModelHasBoost methods for cache read and write to see whats going on.

since you are using an api vardumping is not ideal. maybe you could log these to a file or use a tool like rayapp.

I think i found a possible case where an invalid cache might be created.

It happened if the modfied timestamp could not be retrieved. It kept the old cache. Now it will clear the old cached value instead.

I will create a release next week. but you could test it… its one line.

To clear the currently invalid cache for your page call ˋ$page->deleteContentCache();ˋ once

That state where the modified timestamp could not be read happened to me in my tests as well thus the if clause but its hard to replicate. Multiple file access in rapid succession, locked content file from kirby (?), not flushed timestamp on harddisk level…
But the fix should at least avoid invalid states now. Thanks for pointing out that issue.

my problem still occurs. i thought after clearing the cache the problem is resolved, but it didn’t.

i am out of my wits. unless you send me a reproducable example i dont know how to help you here. you could also contact me via discord and we could arrange for a screenshare if you dont want to send me any code.

i think the issue stems from non-translatable fields. those set to translate: false in the blueprint. the cache will check the language specific modified timestamp (using $page->modified()). but that does not reflect any changes you made on non-translatable fields in your default language. changing these does NOT update the modified timestamp of the other content files.

what you need to do is either

  • update lapse plugin - pushed a fix a few minutes ago or
  • add $page->modified(kirby()->languages()->default()->code()) to every cache key. you need to add so the key will reflect both language from request and default language
$cacheKeyWrong = $page->modified();
$cacheKeyWithNonTranslatable = $page->modified() . $page->modified(kirby()->languages()->default()->code());