diff --git a/modules/ppcp-api-client/src/Helper/class-cache.php b/modules/ppcp-api-client/src/Helper/class-cache.php index 2af1e5246..503e95739 100644 --- a/modules/ppcp-api-client/src/Helper/class-cache.php +++ b/modules/ppcp-api-client/src/Helper/class-cache.php @@ -41,6 +41,26 @@ class Cache { return get_transient( $this->prefix . $key ); } + /** + * Whether a value is stored or not. + * + * @param string $key The key for the value. + * + * @return bool + */ + public function has( string $key ): bool { + return $this->get( $key ) !== false; + } + + /** + * Deletes a cache. + * + * @param string $key The key. + */ + public function delete( string $key ) { + delete_transient( $this->prefix . $key ); + } + /** * Caches a value. *