Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache items fetched during the request in memory #8

Merged
merged 2 commits into from
Nov 8, 2024

Conversation

dlh01
Copy link
Member

@dlh01 dlh01 commented Nov 8, 2024

This is a nod towards #7, although not as flexible or comprehensive as that issue envisions.

Copy link

@scottnelle scottnelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👻

$value = $this->cache[ $group ][ $key ];

if ( is_object( $value ) ) {
$value = clone $value;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gather that this is an established pattern when accessing objects from an array, but I wouldn't mind a comment here as to why so it's clear to future readers that you didn't intend to assign this clone to a new variable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. I added a comment. It's not about the array, rather about not reusing the object instance.

@dlh01 dlh01 merged commit 436d68f into main Nov 8, 2024
6 checks passed
@dlh01 dlh01 deleted the feature/in-memory-cache branch November 8, 2024 18:56
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