projects
/
pharext
/
pharext.org
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
add logging; fix caching
[pharext/pharext.org]
/
app
/
Github
/
Storage
/
Session.php
diff --git
a/app/Github/Storage/Session.php
b/app/Github/Storage/Session.php
index 943e975b25456e3e6c1e0758a8281f3e8107427e..f16cdb33b234fc4874e597f2d4de57b5875a79b4 100644
(file)
--- a/
app/Github/Storage/Session.php
+++ b/
app/Github/Storage/Session.php
@@
-12,24
+12,22
@@
class Session implements Storage
$this->ns = $ns;
}
$this->ns = $ns;
}
- function set($key,
$val, $ttl = null
) {
- $_SESSION[$this->ns][$key] =
[$val, $ttl, isset($ttl) ? time() : null]
;
+ function set($key,
Item $item
) {
+ $_SESSION[$this->ns][$key] =
$item
;
return $this;
}
return $this;
}
- function get($key,
&$val = null, &$ltl
= null, $update = false) {
+ function get($key,
Item &$item
= null, $update = false) {
if (!isset($_SESSION[$this->ns][$key])) {
return false;
}
if (!isset($_SESSION[$this->ns][$key])) {
return false;
}
-
list($val, $ttl, $set)
= $_SESSION[$this->ns][$key];
- if (
!isset($ttl
)) {
+
$item
= $_SESSION[$this->ns][$key];
+ if (
null === $item->getTTL(
)) {
return true;
}
return true;
}
- $now = time();
- $ltl = $ttl - ($now - $set);
- if ($ltl >= 0) {
+ if ($item->getLTL() >= 0) {
if ($update) {
if ($update) {
- $
_SESSION[$this->ns][$key][2] = $now
;
+ $
item->setTimestamp()
;
}
return true;
}
}
return true;
}