Skip to content

Performance: Handle badger cache invalidation and extend TTLs - #3584

Open
shleeable wants to merge 5 commits into
fosrl:mainfrom
shleeable:feature/cache-ttl-increase
Open

Performance: Handle badger cache invalidation and extend TTLs#3584
shleeable wants to merge 5 commits into
fosrl:mainfrom
shleeable:feature/cache-ttl-increase

Conversation

@shleeable

@shleeable shleeable commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Description

Cache invalidation is immediate for the same process. This eliminates stale data for the common admin operations (updating resource settings, toggling rules) while dramatically reducing DB load on the hot request path.

  • Create badgerCacheInvalidation module with helpers to invalidate specific cache entries
  • Wire invalidation into updateResource and deleteResource (clears resource, headerAuth, userAccess caches)
  • Wire invalidation into createResourceRule, updateResourceRule, deleteResourceRule
  • Increase resource/rules/headerAuth cache TTLs

How to test?

- Create badgerCacheInvalidation module with helpers to invalidate specific cache entries
- Wire invalidation into updateResource (clears resource, headerAuth, userAccess caches)
- Wire invalidation into createResourceRule, updateResourceRule, deleteResourceRule
- Wire invalidation into deleteResource
- Increase resource/rules/headerAuth cache TTLs to 1 hour (safe with invalidation)
- Keep session cache at 60s as a safety net (session deletion paths are numerous)
- Keep userAccess/userData at 12s (role changes touch too many paths for this PR)

Cache invalidation is immediate for the same process. This eliminates stale
data for the common admin operations (updating resource settings, toggling rules)
while dramatically reducing DB load on the hot request path.
@shleeable
shleeable marked this pull request as draft August 14, 2026 06:04
@shleeable
shleeable marked this pull request as ready for review August 14, 2026 06:12
@shleeable
shleeable marked this pull request as draft August 14, 2026 06:14
@shleeable
shleeable force-pushed the feature/cache-ttl-increase branch from 667fa20 to 06b4e43 Compare August 14, 2026 06:18
@shleeable
shleeable marked this pull request as ready for review August 14, 2026 06:23
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.

1 participant