-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
31 lines (27 loc) · 755 Bytes
/
functions.php
File metadata and controls
31 lines (27 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
use Rockschtar\WordPress\ObjectStorage\ObjectStorage;
/**
* @param string $key
* @param mixed $value
* @param int $expiration Optional. Time until expiration in seconds. Default 0 (no expiration).
* @return bool
*/
function rsos_set_object(string $key, mixed $value, int $expiration = 0): bool {
$objectStorage = new ObjectStorage();
return $objectStorage->set($key, $value, $expiration);
}
/**
* @param string $key
*/
function rsos_delete_object(string $key) : void {
$objectStorage = new ObjectStorage();
$objectStorage->delete($key);
}
/**
* @param string $key
* @return false|mixed
*/
function rsos_get_object(string $key) : mixed {
$objectStorage = new ObjectStorage();
return $objectStorage->get($key);
}