Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow plugins to add to admin cache list #10833

Merged
merged 4 commits into from
Aug 14, 2022

Conversation

oplik0
Copy link
Contributor

@oplik0 oplik0 commented Aug 13, 2022

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 expose max and size (which is renamed to itemCount 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. Added these properties, along with dump, to the ttl cache wrapper

EDIT: an example implementation in a plugin can be seen here: https://github.com/oplik0/nodebb-plugin-two-way-block/tree/cache-metrics

resolves  NodeBB#10820

plugins will have to use `filter:admin.cache.get` hook and just add their own cache to the object there.
@nodebb-misty
Copy link
Contributor

💡 Friendly Note

This pull request was made against the develop branch, which is reserved for commits destined for a minor or major release.If your commits simply fixes a bug, please rebase this PR against the master instead.

  • patch releases — bug fixes only
  • minor releases — new features, enhancements, and bug fixes
  • major releases — breaking changes, including all of the above

Thanks!

@barisusakli barisusakli merged commit a9bbb58 into NodeBB:develop Aug 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants