feat: allow plugins to add to admin cache list #10833
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
resolves #10820
plugins will have to use
filter:admin.cache.get
hook and just add their own cache to the object there.Currently the template has a special case for configuring postCache size - however this could potentially be also made configurable, but since there isn't really a way to tell if that property is fixed, there would need to be a separate property for this (
configurableSize
?).There is also now an easy way to add the caches that didn't make it to ACP before - blocks cache, ip cache (from analytics) and the two rate limiting caches (delayCache and the uploads rate limit cache). Please let me know if I should do so while I'm working with this :)
Additionally, TTLCache will only work partially, since the NodeBB wrapper doesn't exposeAdded these properties, along withmax
andsize
(which is renamed toitemCount
in lru cache wrapper). This should be trivial to add, but I'm not sure if it's in scope of this PR (and wanted). If that's the case though I'll be glad to add this here too.dump
, to the ttl cache wrapperEDIT: an example implementation in a plugin can be seen here: https://github.com/oplik0/nodebb-plugin-two-way-block/tree/cache-metrics