CC-5555 : Implement simple caching for preferences
cache key creation change.
This commit is contained in:
parent
0bae60138f
commit
b8a084998e
2 changed files with 14 additions and 8 deletions
|
@ -3,24 +3,30 @@
|
|||
class Cache
|
||||
{
|
||||
|
||||
private function createCacheKey($key, $userId = null) {
|
||||
private function createCacheKey($key, $isUserValue, $userId = null) {
|
||||
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
$a = $CC_CONFIG["apiKey"][0];
|
||||
$cacheKey = "{$key}{$userId}{$a}";
|
||||
|
||||
if ($isUserValue) {
|
||||
$cacheKey = "{$key}{$userId}{$a}";
|
||||
}
|
||||
else {
|
||||
$cacheKey = "{$key}{$a}";
|
||||
}
|
||||
|
||||
return $cacheKey;
|
||||
}
|
||||
|
||||
public function store($key, $value, $userId = null) {
|
||||
public function store($key, $value, $isUserValue, $userId = null) {
|
||||
|
||||
$cacheKey = self::createCacheKey($key, $userId);
|
||||
return apc_store($cacheKey, $value);
|
||||
}
|
||||
|
||||
public function fetch($key, $userId = null) {
|
||||
public function fetch($key, $isUserValue, $userId = null) {
|
||||
|
||||
$cacheKey = self::createCacheKey($key, $userId);
|
||||
$cacheKey = self::createCacheKey($key, $isUserValue, $userId);
|
||||
return apc_fetch($cacheKey);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue