5bd6bbedf2db778a862ad78d0b7c1aaa0b188e9c
3 namespace app\Github\Storage
;
11 function __construct($value, $ttl = null, $time = null) {
12 $this->value
= $value;
14 $this->time
= $time ?
: time();
17 static function __set_state(array $state) {
19 isset($state["value"]) ?
$state["value"] : null,
20 isset($state["ttl"]) ?
$state["ttl"] : null,
21 isset($state["time"]) ?
$state["time"] : null
26 return get_object_vars($this);
29 function getTimestamp() {
33 function setTimestamp($ts = null) {
34 $this->time
= $ts ?
: time();
42 function setTTL($ttl = null) {
47 function getAge($from = null) {
48 return ($from ?
: time()) - $this->time
;
51 function getLTL($from = null) {
52 return $this->ttl
- $this->getAge($from);
59 function setValue($value = null) {
60 $this->value
= $value;