mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
add delete and has method to Cache
This commit is contained in:
parent
3803ba935c
commit
bc6be4993a
1 changed files with 20 additions and 0 deletions
|
@ -41,6 +41,26 @@ class Cache {
|
||||||
return get_transient( $this->prefix . $key );
|
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.
|
* Caches a value.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue