Skip to content

feat(cache): introduce GravitinoCache interface with Caffeine and no-op implementations#10794

Closed
yuqi1129 wants to merge 2 commits intoapache:mainfrom
yuqi1129:feat/cache-gravitino-cache
Closed

feat(cache): introduce GravitinoCache interface with Caffeine and no-op implementations#10794
yuqi1129 wants to merge 2 commits intoapache:mainfrom
yuqi1129:feat/cache-gravitino-cache

Conversation

@yuqi1129
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

  • Adds GravitinoCache<K, V> interface (extends Closeable) with getIfPresent, put, invalidate, invalidateAll, invalidateByPrefix, size, close
  • Implements CaffeineGravitinoCache<K, V> backed by Caffeine with configurable maxSize and ttlSeconds; invalidateByPrefix does an O(n) key scan (acceptable for rare DDL invalidations)
  • Implements NoOpsGravitinoCache<K, V> for testing (all operations are no-ops)

Builds on: #10793

Why are the changes needed?

A shared cache abstraction allows the auth path caches (userRoleCache, groupRoleCache, metadataIdCache, ownerRelCache, loadedRoles) to be swapped between real Caffeine caches and no-op caches in tests without changing the call sites.

Does this PR introduce any user-facing changes?

No.

How was this patch tested?

  • ./gradlew :core:test -PskipITs

🤖 Generated with Claude Code

yuqi1129 and others added 2 commits April 15, 2026 23:28
- Add upgrade SQL script (1.2.0 -> 1.3.0) with updated_at columns on
  role_meta, user_meta, group_meta, owner_meta, and entity_change_log table
- Add result record types in po/auth: UserAuthInfo, GroupAuthInfo,
  OwnerInfo, RoleUpdatedAt, ChangedOwnerInfo, EntityChangeRecord
- Add touchUpdatedAt/batchGetUpdatedAt to RoleMetaMapper and providers
- Add touchUpdatedAt/getUserInfo to UserMetaMapper and providers
- Add touchUpdatedAt/getGroupInfoByUserId to GroupMetaMapper and providers
- Add selectOwnerByMetadataObjectId/selectChangedOwners to OwnerMetaMapper
- Create EntityChangeLogMapper with selectChanges/insertChange/pruneOldEntries
- Register EntityChangeLogMapper in DefaultMapperPackageProvider

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…op implementations

- Add GravitinoCache<K, V> interface with get/put/invalidate/invalidateByPrefix/size/close
- Implement CaffeineGravitinoCache backed by Caffeine with TTL and maxSize config
- Implement NoOpsGravitinoCache for testing (all methods are no-ops)
- invalidateByPrefix enables cascade invalidation for DDL operations

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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