Feat: Introduce LRU cache. (kubevela/pkg#138)
RO
3mo ago+597+597+012345678901234567890123456789-1-1-0123456789
Summary
- Copy of kubevela/pkg#138 (
kash2104:issue-136) onto this fork so the Snyk GitHub integration can run against the same commits. - Fork
mainis synced withkubevela/pkgmain(b40d331). - Head is the exact upstream PR tip (
4bdf3b1).
Test plan
- Confirm Snyk PR check appears on this PR
- Compare the Snyk failure with the upstream check on kubevela/pkg#138 (
security/snyk (kubevela))
Summary by CodeRabbit
- New Features
- Added a thread-safe, generic LRU cache with typed keys and values.
- Supports expiration, capacity and byte-size limits, automatic cleanup, and purge operations.
- Added eviction notifications with reasons for expiration, replacement, deletion, capacity limits, and purging.
- Added memory usage tracking and configurable value sizing.
- Tests
- Added coverage for expiration, eviction, deletion, replacement, purging, limits, callbacks, and cancellation.