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

Exception Thrown If Setting Same Value #17

Open
XedinUnknown opened this issue Oct 19, 2020 · 0 comments
Open

Exception Thrown If Setting Same Value #17

XedinUnknown opened this issue Oct 19, 2020 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@XedinUnknown
Copy link
Member

The Problem

When using CachePool to set one or multiple values, an exception is thrown when the value for the specified key is already what is being set. In other words, setting the same value for the same key twice in succession will result in an error.

This is because under the hood update_option() (the function that WP uses to set transients) will return false in such a scenario.

Suggested Solution

Introduce an additional check in CachePool: if setting fails, get the current value and if it's the same as the new one - don't throw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant