Exception Thrown If Setting Same Value
XedinUnknown opened this issue · 0 comments
XedinUnknown commented
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.