fix: prefix-based cache invalidation for guild and wallet scopes (#79)#101
Merged
Lakes41 merged 1 commit intoJun 27, 2026
Merged
Conversation
…mantine-guild#79) - Add optional deleteByPrefix to CacheAdapter interface - Implement deleteByPrefix in InMemoryCacheAdapter - Update invalidateGuildCache to use deleteByPrefix (fixes composite key deletion) - Update invalidateWalletCache to use prefix deletion instead of full clear - Fallback to exact-key delete for legacy adapters without deleteByPrefix - Add comprehensive tests for prefix deletion and edge cases Closes Adamantine-guild#79
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
deleteByPrefixtoCacheAdapterinterfacedeleteByPrefixinInMemoryCacheAdapterinvalidateGuildCacheto use prefix deletion (was only deleting exact keys, missing composite keys likeaccess:checkAccess:guild:resource:wallet)invalidateWalletCacheto use prefix deletion instead of clearing entire cachedeleteByPrefixBug
invalidateGuildCachebuilt prefix keys but calledcache.delete(key)which only removes exact matches. Composite cache entries with wallet/resource suffixes were never removed.Tests added
deleteByPrefixremoves all matching keys, preserves othersinvalidateGuildCacheremoves composite-key entries via prefixinvalidateWalletCacheuses prefix deletion, preserves other walletsdeleteByPrefixCloses #79