-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2382336
commit f0749f7
Showing
8 changed files
with
217 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
class ApcCacheProvider implements ICacheProvider { | ||
protected $reportsTo; | ||
|
||
function reportsTo(ICacheProvider $cache) { | ||
if(!$cache instanceof ICacheProvider) { | ||
$cache = new NoOpCacheProvider(); | ||
} | ||
|
||
if(isset($this->reportsTo)) { | ||
$temp = $this->reportsTo; | ||
$this->reportsTo = $cache; | ||
$this->reportsTo->reportsTo($temp); | ||
} else { | ||
$this->reportsTo = $cache; | ||
} | ||
} | ||
|
||
function set($key, $value, $duration = 0) { | ||
apc_store($key, $value, $duration); | ||
$this->reportsTo->set($key, $value, $duration); | ||
} | ||
|
||
function get($key) { | ||
$result = apc_fetch($key); | ||
if($result === false) { | ||
$result = $this->reportsTo->get($key); | ||
if($result !== false) { | ||
$this->set($key, $result); | ||
} | ||
} | ||
return $result; | ||
} | ||
|
||
function delete($key) { | ||
apc_delete($key); | ||
$this->reportsTo->delete($key); | ||
} | ||
|
||
function clear() { | ||
apc_clear_cache('user'); | ||
$this->reportsTo->clear(); | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
<?php | ||
Library::import('Config'); | ||
|
||
Library::import('recess.http.ForwardingResponse'); | ||
/** | ||
|
Oops, something went wrong.