| 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 |
} |