Skip to content

feat: add getCacheTags() method to replace direct property access#29

Merged
jwadhams merged 1 commit intodevelopmentfrom
get-cache-tags-method
Apr 2, 2026
Merged

feat: add getCacheTags() method to replace direct property access#29
jwadhams merged 1 commit intodevelopmentfrom
get-cache-tags-method

Conversation

@jwadhams
Copy link
Copy Markdown
Collaborator

@jwadhams jwadhams commented Apr 2, 2026

Summary

  • Adds getCacheTags(): array to AbstractRequest, returning $this->cacheTags by default
  • All internal cache interactions in AbstractRequest and AbstractUseStaleRequest now go through getCacheTags() instead of the property directly
  • RequestClassAssertions updated to call $request->getCacheTags() instead of the getProperty reflection helper

Motivation

It's a recurring pattern (e.g. carsdotcom/modern-retailing-shared#3591) for implementers to set cacheTags in the constructor, where the tags are really just derived from other properties — not independent state that needs to be serialized. Providing getCacheTags() as the extension point lets future implementers simply override the method instead, keeping tags derived rather than stored.

🤖 Generated with Claude Code

Implementers can now override getCacheTags() to derive tags from other
properties rather than setting state in the constructor. The property
remains as the default backing store but is no longer accessed directly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jwadhams jwadhams force-pushed the get-cache-tags-method branch from 1fb3bdf to 1a6e2dd Compare April 2, 2026 17:10
@jwadhams jwadhams merged commit 63e18b4 into development Apr 2, 2026
14 checks passed
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.

2 participants