projects
/
pharext
/
pharext.org
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
use starge driver prefix option
[pharext/pharext.org]
/
app
/
Github
/
Storage
/
Memcache.php
diff --git
a/app/Github/Storage/Memcache.php
b/app/Github/Storage/Memcache.php
index 452574b9dbb9f4dfec9b9516bb0003eb2b83e6b5..5e4959b9bc0c028c6523f05e0288e6a4e5fd0e9d 100644
(file)
--- a/
app/Github/Storage/Memcache.php
+++ b/
app/Github/Storage/Memcache.php
@@
-14,16
+14,13
@@
class Memcache implements Storage
if (!$mc) {
$mc = new \Memcached("pharext");
$mc->addServer("localhost", 11211);
if (!$mc) {
$mc = new \Memcached("pharext");
$mc->addServer("localhost", 11211);
+ $mc->setOption(\Memcached::OPT_PREFIX_KEY, "$ns:");
}
$this->mc = $mc;
}
}
$this->mc = $mc;
}
- private function key($key) {
- return sprintf("%s:%s", $this->ns, $key);
- }
-
function get($key, Item &$item = null, $update = false) {
function get($key, Item &$item = null, $update = false) {
- if (!$item = $this->mc->get($
this->key($key)
)) {
+ if (!$item = $this->mc->get($
key
)) {
return false;
}
return false;
}
@@
-33,7
+30,7
@@
class Memcache implements Storage
if ($item->getLTL() >= 0) {
if ($update) {
$item->setTimestamp();
if ($item->getLTL() >= 0) {
if ($update) {
$item->setTimestamp();
- $this->mc->set($
this->key($key)
, $item, $item->getTTL() + 60*60*24);
+ $this->mc->set($
key
, $item, $item->getTTL() + 60*60*24);
}
return true;
}
}
return true;
}
@@
-41,11
+38,11
@@
class Memcache implements Storage
}
function set($key, Item $item) {
}
function set($key, Item $item) {
- $this->mc->set($
this->key($key)
, $item, (null !== $item->getTTL()) ? $item->getTTL() + 60*60*24 : 0);
+ $this->mc->set($
key
, $item, (null !== $item->getTTL()) ? $item->getTTL() + 60*60*24 : 0);
return $this;
}
function del($key) {
return $this;
}
function del($key) {
- $this->mc->delete($
this->key($key)
);
+ $this->mc->delete($
key
);
}
}
}
}