Skip to content

Exception Thrown If Setting Same Value #17

@XedinUnknown

Description

@XedinUnknown

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions