Skip to content

Add memoization groups (group: option) for v1.5.0#60

Merged
eclectic-coding merged 2 commits into
mainfrom
feature/v1.5.0
Jun 2, 2026
Merged

Add memoization groups (group: option) for v1.5.0#60
eclectic-coding merged 2 commits into
mainfrom
feature/v1.5.0

Conversation

@eclectic-coding
Copy link
Copy Markdown
Owner

Summary

  • Adds group: option to memoize — tags a method with a named invalidation group so related methods can be busted in one operation
  • reset_memo_group(group_name) instance method clears all per-instance cached entries for every method in the group; reset_shared_memo_group(group_name) is the class-level equivalent for shared: true methods
  • Introspection: memo_groups, memo_group_methods(group_name) on instances; safe_memo_groups, safe_memo_group_methods(group_name) on the class
  • group: is accepted by safe_memoize_options as a class-wide default
  • A method belongs to at most one group; re-memoizing with a different group: moves it

Test plan

  • bundle exec rake — 833 examples, 0 failures, 100% line coverage, lint clean
  • 22 new examples covering: basic invalidation, no-op for unknown groups, string/symbol interop, shared-mode group reset, validation errors, group reassignment, safe_memoize_options integration, on_evict hook fires on group reset
  • Existing 811 tests unaffected

🤖 Generated with Claude Code

eclectic-coding and others added 2 commits June 2, 2026 13:30
…1.5.0)

- `memoize :method, group: :name` tags a method with a named invalidation group
- `reset_memo_group(group)` on instances clears all per-instance entries for the group
- `reset_shared_memo_group(group)` on the class clears shared-cache entries for the group
- `memo_group_methods(group)` / `memo_groups` for instance-level introspection
- `safe_memo_group_methods(group)` / `safe_memo_groups` for class-level introspection
- `group:` accepted by `safe_memoize_options` as a class-wide default
- A method belongs to at most one group; re-memoizing with a different group moves it
- 22 new tests, 100% line coverage maintained

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Update CHANGELOG, ROADMAP, and README for the group: option,
reset_memo_group, reset_shared_memo_group, and related introspection methods.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@eclectic-coding eclectic-coding merged commit efca5bf into main Jun 2, 2026
4 checks passed
@eclectic-coding eclectic-coding deleted the feature/v1.5.0 branch June 2, 2026 18:15
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