Closed tom-m-clarity-growth closed 2 months ago
Hey there! Which version of Statamic are you running on this site?
Thanks!
If you are using the no cache tag I would recommend using the select="..." param to select the variables you need, otherwise it will create a new no cache region for every user on the site, which is why you're seeing progressively more usage.
Beyond that, you may want to look at an add-on we provide - https://statamic.com/addons/thoughtco/cache-tracker - which tracks what items are output on a page allowing the cache to be selectively cleared. It does what you are trying but without using no cache tags.
Which version of Statamic are you running on this site?
Statamic 4.58.2
If you are using the no cache tag I would recommend using the select="..." param to select the variables you need, otherwise it will create a new no cache region for every user on the site, which is why you're seeing progressively more usage.
Beyond that, you may want to look at an add-on we provide - https://statamic.com/addons/thoughtco/cache-tracker - which tracks what items are output on a page allowing the cache to be selectively cleared. It does what you are trying but without using no cache tags.
Thanks for the explanation!
I didn't see the documentation on select for nocache tags before, but thats super helpful.
As for the creation of an instance per user, this would explain the ever expanding cache. It may be worth a warning being added to the statamic docs to prevent others from creating the same issue for themselves.
Looks like your addon is the solution we were originally trying to achieve here anyway!
Bug description
I have implemented a caching strategy using a combination of the app cache for items that are updated intermittently using the
cache
tag with a key. I then wrapped them in anocache
tag to keep them dynamic so i could static cache the rest of the page:with an event listener set up:
The issue is that the disk space on the sites this is used on is steadily climbing to its limit without tending toward a maximum which would suggest invalidated cache's aren't being deleted once invalidated but instead replaced by new cache data that is referenced in place of the original.
![image (2)](https://github.com/statamic/cms/assets/166156903/f1443826-4149-4ae9-b085-b9f6f355e3cd)
I'm relatively new to the inner workings of statamic so I was wondering what was going wrong. I'm looking into an alternative solution suggested here in the meantime, but it would be useful to know if this is a bug as it would be nice if it could be addressed to prevent any requirement for me to change these implementations. Alternatively if it isn't a bug, it would be useful if a warning and/or explanation could be added to the documentation to prevent others making the same mistake as me.
How to reproduce
Using a half static caching strategy, wrap a
cache
tag with anocache
tag in a template to allow for cached semi-dynamic content within a static page:with an event listener set up in
app/Providers/EventServiceProvider.php
:Logs
No response
Environment
Installation
Other (please explain)
Additional details
Installed on our own internal starter kit