| 1 |
<?php |
| 2 |
|
| 3 |
namespace Templately\Utils; |
| 4 |
|
| 5 |
class Database extends Base { |
| 6 |
|
| 7 |
/** |
| 8 |
* Set transient to options table |
| 9 |
* |
| 10 |
* @since 2.0.0 |
| 11 |
* |
| 12 |
* @param string $key |
| 13 |
* @param mixed $value |
| 14 |
* @param int $expiration |
| 15 |
* |
| 16 |
* @return bool |
| 17 |
*/ |
| 18 |
public static function set_transient( $key, $value, $expiration = DAY_IN_SECONDS ) { |
| 19 |
$key = '_templately_' . trim( $key ); |
| 20 |
return set_transient( $key, $value, $expiration ); |
| 21 |
} |
| 22 |
|
| 23 |
/** |
| 24 |
* Get transient data from options table. |
| 25 |
* |
| 26 |
* @since 2.0.0 |
| 27 |
* @param string $key |
| 28 |
* |
| 29 |
* @return mixed |
| 30 |
*/ |
| 31 |
public static function get_transient( $key ) { |
| 32 |
$key = '_templately_' . trim( $key ); |
| 33 |
return get_transient( $key ); |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Delete transient data from options table. |
| 38 |
* |
| 39 |
* @param string $key Transient key. |
| 40 |
* @return bool |
| 41 |
*/ |
| 42 |
public static function delete_transient( $key ) { |
| 43 |
$key = '_templately_' . trim( $key ); |
| 44 |
return delete_transient( $key ); |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
} |
| 49 |
|