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

[1.x] Ensure cache holds serialized values only #83

Merged
merged 2 commits into from
Jan 10, 2024
Merged

Conversation

timacdonald
Copy link
Member

fixes #82

The cache is currently holding onto scope object, which is a potential memory issue as all scope will now stay in memory until the end of the request.

It also means that the cache behaves unexpectedly for eloquent models when different instances of the same record are used, e.g.,

Feature::for(User::find(123))->activate('foo');

Feature::for(User::find(123))->activate('foo');

This fixes the memory issue and model reference issues by making sure the scope is serialized before it enters the cache.

@taylorotwell taylorotwell merged commit d80eff7 into 1.x Jan 10, 2024
4 checks passed
@taylorotwell taylorotwell deleted the caching branch January 10, 2024 13:18
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.

Cache wrapper not updating model-scoped features correctly
2 participants