$cache = Cache::instance();
if($cache) {
- $key = common_cache_key('attachments:etag:' . $this->path);
+ $key = Cache::key('attachments:etag:' . $this->path);
$etag = $cache->get($key);
if($etag === false) {
$etag = crc32(file_get_contents($this->path));
$c = self::memcache();
if (!empty($c)) {
- $settings = $c->get(common_cache_key(self::settingsKey));
+ $settings = $c->get(Cache::key(self::settingsKey));
if ($settings !== false) {
return $settings;
}
$config->free();
if (!empty($c)) {
- $c->set(common_cache_key(self::settingsKey), $settings);
+ $c->set(Cache::key(self::settingsKey), $settings);
}
return $settings;
$c = self::memcache();
if (!empty($c)) {
- $c->delete(common_cache_key(self::settingsKey));
+ $c->delete(Cache::key(self::settingsKey));
}
}
}
str_replace("\n", " ", $e->getTraceAsString()));
}
$vstr = self::valueString($v);
- return common_cache_key(strtolower($cls).':'.$k.':'.$vstr);
+ return Cache::key(strtolower($cls).':'.$k.':'.$vstr);
}
static function getcached($cls, $k, $v) {
return $inst;
}
$key_part = Cache::keyize($cls).':'.md5($qry);
- $ckey = common_cache_key($key_part);
+ $ckey = Cache::key($key_part);
$stored = $c->get($ckey);
if ($stored !== false) {
$keyPart = vsprintf($format, $args);
- $cacheKey = common_cache_key($keyPart);
+ $cacheKey = Cache::key($keyPart);
return $c->delete($cacheKey);
}
return false;
}
- $cacheKey = common_cache_key($keyPart);
+ $cacheKey = Cache::key($keyPart);
return $c->get($cacheKey);
}
return false;
}
- $cacheKey = common_cache_key($keyPart);
+ $cacheKey = Cache::key($keyPart);
return $c->set($cacheKey, $value, $flag, $expiry);
}
$c = self::memcache();
if (!empty($c)) {
- $ni = $c->get(common_cache_key('notice:who_gets:'.$this->id));
+ $ni = $c->get(Cache::key('notice:who_gets:'.$this->id));
if ($ni !== false) {
return $ni;
}
if (!empty($c)) {
// XXX: pack this data better
- $c->set(common_cache_key('notice:who_gets:'.$this->id), $ni);
+ $c->set(Cache::key('notice:who_gets:'.$this->id), $ni);
}
return $ni;
$max_id)));
}
- $idkey = common_cache_key($cachekey);
+ $idkey = Cache::key($cachekey);
$idstr = $cache->get($idkey);
if (empty($cache)) {
$ids = $this->_repeatStreamDirect($limit);
} else {
- $idstr = $cache->get(common_cache_key('notice:repeats:'.$this->id));
+ $idstr = $cache->get(Cache::key('notice:repeats:'.$this->id));
if ($idstr !== false) {
$ids = explode(',', $idstr);
} else {
$ids = $this->_repeatStreamDirect(100);
- $cache->set(common_cache_key('notice:repeats:'.$this->id), implode(',', $ids));
+ $cache->set(Cache::key('notice:repeats:'.$this->id), implode(',', $ids));
}
if ($limit < 100) {
// We do a max of 100, so slice down to limit
$c = Cache::instance();
if (!empty($c)) {
- $cnt = $c->get(common_cache_key('profile:subscription_count:'.$this->id));
+ $cnt = $c->get(Cache::key('profile:subscription_count:'.$this->id));
if (is_integer($cnt)) {
return (int) $cnt;
}
$cnt = ($cnt > 0) ? $cnt - 1 : $cnt;
if (!empty($c)) {
- $c->set(common_cache_key('profile:subscription_count:'.$this->id), $cnt);
+ $c->set(Cache::key('profile:subscription_count:'.$this->id), $cnt);
}
return $cnt;
{
$c = Cache::instance();
if (!empty($c)) {
- $cnt = $c->get(common_cache_key('profile:subscriber_count:'.$this->id));
+ $cnt = $c->get(Cache::key('profile:subscriber_count:'.$this->id));
if (is_integer($cnt)) {
return (int) $cnt;
}
$cnt = (int) $sub->count('distinct subscriber');
if (!empty($c)) {
- $c->set(common_cache_key('profile:subscriber_count:'.$this->id), $cnt);
+ $c->set(Cache::key('profile:subscriber_count:'.$this->id), $cnt);
}
return $cnt;
{
$c = Cache::instance();
if (!empty($c)) {
- $cnt = $c->get(common_cache_key('profile:fave_count:'.$this->id));
+ $cnt = $c->get(Cache::key('profile:fave_count:'.$this->id));
if (is_integer($cnt)) {
return (int) $cnt;
}
$cnt = (int) $faves->count('distinct notice_id');
if (!empty($c)) {
- $c->set(common_cache_key('profile:fave_count:'.$this->id), $cnt);
+ $c->set(Cache::key('profile:fave_count:'.$this->id), $cnt);
}
return $cnt;
$c = Cache::instance();
if (!empty($c)) {
- $cnt = $c->get(common_cache_key('profile:notice_count:'.$this->id));
+ $cnt = $c->get(Cache::key('profile:notice_count:'.$this->id));
if (is_integer($cnt)) {
return (int) $cnt;
}
$cnt = (int) $notices->count('distinct id');
if (!empty($c)) {
- $c->set(common_cache_key('profile:notice_count:'.$this->id), $cnt);
+ $c->set(Cache::key('profile:notice_count:'.$this->id), $cnt);
}
return $cnt;
{
$c = Cache::instance();
if (!empty($c)) {
- $c->delete(common_cache_key('profile:subscriber_count:'.$this->id));
+ $c->delete(Cache::key('profile:subscriber_count:'.$this->id));
}
}
{
$c = Cache::instance();
if (!empty($c)) {
- $c->delete(common_cache_key('profile:subscription_count:'.$this->id));
+ $c->delete(Cache::key('profile:subscription_count:'.$this->id));
}
}
{
$c = Cache::instance();
if (!empty($c)) {
- $c->delete(common_cache_key('profile:fave_count:'.$this->id));
+ $c->delete(Cache::key('profile:fave_count:'.$this->id));
}
}
{
$c = Cache::instance();
if (!empty($c)) {
- $c->delete(common_cache_key('profile:notice_count:'.$this->id));
+ $c->delete(Cache::key('profile:notice_count:'.$this->id));
}
}
if ($cache) {
// Faves don't happen chronologically, so we need to blow
// ;last cache, too
- $cache->delete(common_cache_key('fave:ids_by_user:'.$this->id));
- $cache->delete(common_cache_key('fave:ids_by_user:'.$this->id.';last'));
- $cache->delete(common_cache_key('fave:ids_by_user_own:'.$this->id));
- $cache->delete(common_cache_key('fave:ids_by_user_own:'.$this->id.';last'));
+ $cache->delete(Cache::key('fave:ids_by_user:'.$this->id));
+ $cache->delete(Cache::key('fave:ids_by_user:'.$this->id.';last'));
+ $cache->delete(Cache::key('fave:ids_by_user_own:'.$this->id));
+ $cache->delete(Cache::key('fave:ids_by_user_own:'.$this->id.';last'));
}
$profile = $this->getProfile();
$profile->blowFaveCount();
return $_SESSION['token'];
}
-function common_cache_key($extra)
-{
- return Cache::key($extra);
-}
-
function common_license_terms($uri)
{
if(preg_match('/creativecommons.org\/licenses\/([^\/]+)/', $uri, $matches)) {
if ($this->cachePrefix) {
return $this->cachePrefix . ':' . $key;
} else {
- return common_cache_key($key);
+ return Cache::key($key);
}
}
if (!empty($c)) {
$cacheObj = new MemcacheSchemaCache(
array('c'=>$c,
- 'cacheKey' => common_cache_key('ldap_schema:' . $config_id)));
+ 'cacheKey' => Cache::key('ldap_schema:' . $config_id)));
$ldap->registerSchemaCache($cacheObj);
}
self::$ldap_connections[$config_id] = $ldap;
if($this->minifyInlineJs && $type=='text/javascript'){
$c = Cache::instance();
if (!empty($c)) {
- $cacheKey = common_cache_key(self::cacheKey . ':' . crc32($code));
+ $cacheKey = Cache::key(self::cacheKey . ':' . crc32($code));
$out = $c->get($cacheKey);
}
if(empty($out)) {
if($this->minifyInlineCss && $type=='text/css'){
$c = Cache::instance();
if (!empty($c)) {
- $cacheKey = common_cache_key(self::cacheKey . ':' . crc32($code));
+ $cacheKey = Cache::key(self::cacheKey . ':' . crc32($code));
$out = $c->get($cacheKey);
}
if(empty($out)) {
$c = Cache::instance();
if (!empty($c)) {
- $cacheKey = common_cache_key(MinifyPlugin::cacheKey . ':' . $this->file . '?v=' . empty($this->v)?'':$this->v);
+ $cacheKey = Cache::key(MinifyPlugin::cacheKey . ':' . $this->file . '?v=' . empty($this->v)?'':$this->v);
$out = $c->get($cacheKey);
}
if(empty($out)) {
$karg = get_option_value('k', 'key');
if (!empty($karg)) {
- $k = common_cache_key($karg);
+ $k = Cache::key($karg);
} else {
$table = get_option_value('t', 'table');
if (empty($table)) {
$inbox->free();
unset($inbox);
if ($cache) {
- $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
+ $cache->delete(Cache::key('user:notices_with_friends:' . $user->id));
}
}
$karg = get_option_value('k');
if (!empty($karg)) {
- $k = common_cache_key($karg);
+ $k = Cache::key($karg);
} else {
$table = get_option_value('t');
if (empty($table)) {
$user->decache();
- $memc->delete(common_cache_key('user:notices_with_friends:'. $user->id));
- $memc->delete(common_cache_key('user:notices_with_friends:'. $user->id . ';last'));
+ $memc->delete(Cache::key('user:notices_with_friends:'. $user->id));
+ $memc->delete(Cache::key('user:notices_with_friends:'. $user->id . ';last'));
}