Skip to content

fix: scope TimelineCache::forget() to single subject (#12)#20

Draft
AsmitNepali wants to merge 1 commit into1.xfrom
fix-issue-12
Draft

fix: scope TimelineCache::forget() to single subject (#12)#20
AsmitNepali wants to merge 1 commit into1.xfrom
fix-issue-12

Conversation

@AsmitNepali
Copy link
Copy Markdown
Collaborator

Summary

Fixes #12. TimelineCache::forget() previously called Cache::store(...)->getStore()->flush(), wiping the entire cache store — sessions, queue locks, and other application caches sharing the store all got cleared.

TimelineCache now tracks every key it writes in a per-subject index entry and forget() deletes only those keys plus the index.

Changes

  • src/Timeline/TimelineCache.php — new remember() method tracks keys under {prefix}:{class}:{id}:index; forget() reads the index and deletes only the recorded keys plus the index entry.
  • src/Timeline/TimelineBuilder.phppaginate() now calls $cache->remember(...) so writes get indexed.
  • tests/Feature/TimelineCacheTest.php — added two tests:
    • unrelated cache entries survive forgetTimelineCache()
    • other subjects' cached timelines are untouched
  • Docs — removed the "known limitation" callouts in 5.caching.md, 6.troubleshooting/1.index.md, and 6.configuration.md.

(This branch also carries unrelated docs/branding commits already merged into other PRs; the issue-#12 fix is the final commit 1ffb8f00.)

Test plan

  • ./vendor/bin/pest tests/Feature/TimelineCacheTest.php — 4 passed
  • ./vendor/bin/pest full suite — 46 passed

Replace store-wide flush() with per-subject key index. TimelineCache
now tracks cached keys in `{prefix}:{class}:{id}:index` and forget()
deletes only those keys plus the index entry, leaving sessions, queue
locks, and other application caches in the same store untouched.

Also updates docs to remove the "known limitation" callouts.

Fixes #12
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.

TimelineCache::forget() flushes the entire cache store

1 participant