3 namespace app\Github\Storage
;
5 use app\Github\Storage
;
7 class Session
implements Storage
11 function __construct($ns = "github") {
15 function set($key, $val, $ttl = null) {
16 $_SESSION[$this->ns
][$key] = [$val, $ttl, isset($ttl) ?
time() : null];
20 function get($key, &$val = null, &$ltl = null, $update = false) {
21 if (!isset($_SESSION[$this->ns
][$key])) {
24 list($val, $ttl, $set) = $_SESSION[$this->ns
][$key];
29 $ltl = $ttl - ($now - $set);
32 $_SESSION[$this->ns
][$key][2] = $now;
40 unset($_SESSION[$this->ns
][$key]);