common_memcache() => Cache::instance()
This commit is contained in:
parent
6fe2429c41
commit
8f81762d68
|
@ -129,7 +129,7 @@ class GetfileAction extends Action
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache = common_memcache();
|
$cache = Cache::instance();
|
||||||
if($cache) {
|
if($cache) {
|
||||||
$key = common_cache_key('attachments:etag:' . $this->path);
|
$key = common_cache_key('attachments:etag:' . $this->path);
|
||||||
$etag = $cache->get($key);
|
$etag = $cache->get($key);
|
||||||
|
|
|
@ -124,7 +124,7 @@ class Memcached_DataObject extends Safe_DataObject
|
||||||
}
|
}
|
||||||
|
|
||||||
static function memcache() {
|
static function memcache() {
|
||||||
return common_memcache();
|
return Cache::instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
static function cacheKey($cls, $k, $v) {
|
static function cacheKey($cls, $k, $v) {
|
||||||
|
|
|
@ -591,7 +591,7 @@ class Notice extends Memcached_DataObject
|
||||||
|
|
||||||
function getStreamByIds($ids)
|
function getStreamByIds($ids)
|
||||||
{
|
{
|
||||||
$cache = common_memcache();
|
$cache = Cache::instance();
|
||||||
|
|
||||||
if (!empty($cache)) {
|
if (!empty($cache)) {
|
||||||
$notices = array();
|
$notices = array();
|
||||||
|
@ -1585,7 +1585,7 @@ class Notice extends Memcached_DataObject
|
||||||
|
|
||||||
function stream($fn, $args, $cachekey, $offset=0, $limit=20, $since_id=0, $max_id=0)
|
function stream($fn, $args, $cachekey, $offset=0, $limit=20, $since_id=0, $max_id=0)
|
||||||
{
|
{
|
||||||
$cache = common_memcache();
|
$cache = Cache::instance();
|
||||||
|
|
||||||
if (empty($cache) ||
|
if (empty($cache) ||
|
||||||
$since_id != 0 || $max_id != 0 ||
|
$since_id != 0 || $max_id != 0 ||
|
||||||
|
@ -1777,7 +1777,7 @@ class Notice extends Memcached_DataObject
|
||||||
|
|
||||||
function repeatStream($limit=100)
|
function repeatStream($limit=100)
|
||||||
{
|
{
|
||||||
$cache = common_memcache();
|
$cache = Cache::instance();
|
||||||
|
|
||||||
if (empty($cache)) {
|
if (empty($cache)) {
|
||||||
$ids = $this->_repeatStreamDirect($limit);
|
$ids = $this->_repeatStreamDirect($limit);
|
||||||
|
|
|
@ -429,7 +429,7 @@ class Profile extends Memcached_DataObject
|
||||||
|
|
||||||
function subscriptionCount()
|
function subscriptionCount()
|
||||||
{
|
{
|
||||||
$c = common_memcache();
|
$c = Cache::instance();
|
||||||
|
|
||||||
if (!empty($c)) {
|
if (!empty($c)) {
|
||||||
$cnt = $c->get(common_cache_key('profile:subscription_count:'.$this->id));
|
$cnt = $c->get(common_cache_key('profile:subscription_count:'.$this->id));
|
||||||
|
@ -454,7 +454,7 @@ class Profile extends Memcached_DataObject
|
||||||
|
|
||||||
function subscriberCount()
|
function subscriberCount()
|
||||||
{
|
{
|
||||||
$c = common_memcache();
|
$c = Cache::instance();
|
||||||
if (!empty($c)) {
|
if (!empty($c)) {
|
||||||
$cnt = $c->get(common_cache_key('profile:subscriber_count:'.$this->id));
|
$cnt = $c->get(common_cache_key('profile:subscriber_count:'.$this->id));
|
||||||
if (is_integer($cnt)) {
|
if (is_integer($cnt)) {
|
||||||
|
@ -476,7 +476,7 @@ class Profile extends Memcached_DataObject
|
||||||
|
|
||||||
function faveCount()
|
function faveCount()
|
||||||
{
|
{
|
||||||
$c = common_memcache();
|
$c = Cache::instance();
|
||||||
if (!empty($c)) {
|
if (!empty($c)) {
|
||||||
$cnt = $c->get(common_cache_key('profile:fave_count:'.$this->id));
|
$cnt = $c->get(common_cache_key('profile:fave_count:'.$this->id));
|
||||||
if (is_integer($cnt)) {
|
if (is_integer($cnt)) {
|
||||||
|
@ -497,7 +497,7 @@ class Profile extends Memcached_DataObject
|
||||||
|
|
||||||
function noticeCount()
|
function noticeCount()
|
||||||
{
|
{
|
||||||
$c = common_memcache();
|
$c = Cache::instance();
|
||||||
|
|
||||||
if (!empty($c)) {
|
if (!empty($c)) {
|
||||||
$cnt = $c->get(common_cache_key('profile:notice_count:'.$this->id));
|
$cnt = $c->get(common_cache_key('profile:notice_count:'.$this->id));
|
||||||
|
@ -519,7 +519,7 @@ class Profile extends Memcached_DataObject
|
||||||
|
|
||||||
function blowSubscriberCount()
|
function blowSubscriberCount()
|
||||||
{
|
{
|
||||||
$c = common_memcache();
|
$c = Cache::instance();
|
||||||
if (!empty($c)) {
|
if (!empty($c)) {
|
||||||
$c->delete(common_cache_key('profile:subscriber_count:'.$this->id));
|
$c->delete(common_cache_key('profile:subscriber_count:'.$this->id));
|
||||||
}
|
}
|
||||||
|
@ -527,7 +527,7 @@ class Profile extends Memcached_DataObject
|
||||||
|
|
||||||
function blowSubscriptionCount()
|
function blowSubscriptionCount()
|
||||||
{
|
{
|
||||||
$c = common_memcache();
|
$c = Cache::instance();
|
||||||
if (!empty($c)) {
|
if (!empty($c)) {
|
||||||
$c->delete(common_cache_key('profile:subscription_count:'.$this->id));
|
$c->delete(common_cache_key('profile:subscription_count:'.$this->id));
|
||||||
}
|
}
|
||||||
|
@ -535,7 +535,7 @@ class Profile extends Memcached_DataObject
|
||||||
|
|
||||||
function blowFaveCount()
|
function blowFaveCount()
|
||||||
{
|
{
|
||||||
$c = common_memcache();
|
$c = Cache::instance();
|
||||||
if (!empty($c)) {
|
if (!empty($c)) {
|
||||||
$c->delete(common_cache_key('profile:fave_count:'.$this->id));
|
$c->delete(common_cache_key('profile:fave_count:'.$this->id));
|
||||||
}
|
}
|
||||||
|
@ -543,7 +543,7 @@ class Profile extends Memcached_DataObject
|
||||||
|
|
||||||
function blowNoticeCount()
|
function blowNoticeCount()
|
||||||
{
|
{
|
||||||
$c = common_memcache();
|
$c = Cache::instance();
|
||||||
if (!empty($c)) {
|
if (!empty($c)) {
|
||||||
$c->delete(common_cache_key('profile:notice_count:'.$this->id));
|
$c->delete(common_cache_key('profile:notice_count:'.$this->id));
|
||||||
}
|
}
|
||||||
|
|
|
@ -388,7 +388,7 @@ class User extends Memcached_DataObject
|
||||||
|
|
||||||
function hasFave($notice)
|
function hasFave($notice)
|
||||||
{
|
{
|
||||||
$cache = common_memcache();
|
$cache = Cache::instance();
|
||||||
|
|
||||||
// XXX: Kind of a hack.
|
// XXX: Kind of a hack.
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ class User extends Memcached_DataObject
|
||||||
|
|
||||||
function blowFavesCache()
|
function blowFavesCache()
|
||||||
{
|
{
|
||||||
$cache = common_memcache();
|
$cache = Cache::instance();
|
||||||
if ($cache) {
|
if ($cache) {
|
||||||
// Faves don't happen chronologically, so we need to blow
|
// Faves don't happen chronologically, so we need to blow
|
||||||
// ;last cache, too
|
// ;last cache, too
|
||||||
|
|
|
@ -204,7 +204,7 @@ abstract class SpawningDaemon extends Daemon
|
||||||
|
|
||||||
// Reconnect main memcached, or threads will stomp on
|
// Reconnect main memcached, or threads will stomp on
|
||||||
// each other and corrupt their requests.
|
// each other and corrupt their requests.
|
||||||
$cache = common_memcache();
|
$cache = Cache::instance();
|
||||||
if ($cache) {
|
if ($cache) {
|
||||||
$cache->reconnect();
|
$cache->reconnect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -578,7 +578,7 @@ class StompQueueManager extends QueueManager
|
||||||
function incDeliveryCount($msgId)
|
function incDeliveryCount($msgId)
|
||||||
{
|
{
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$cache = common_memcache();
|
$cache = Cache::instance();
|
||||||
if ($cache) {
|
if ($cache) {
|
||||||
$key = 'statusnet:stomp:message-retries:' . $msgId;
|
$key = 'statusnet:stomp:message-retries:' . $msgId;
|
||||||
$count = $cache->increment($key);
|
$count = $cache->increment($key);
|
||||||
|
|
|
@ -142,7 +142,6 @@ function common_switch_locale($language=null)
|
||||||
textdomain("statusnet");
|
textdomain("statusnet");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function common_timezone()
|
function common_timezone()
|
||||||
{
|
{
|
||||||
if (common_logged_in()) {
|
if (common_logged_in()) {
|
||||||
|
@ -1809,11 +1808,6 @@ function common_keyize($str)
|
||||||
return Cache::keyize($str);
|
return Cache::keyize($str);
|
||||||
}
|
}
|
||||||
|
|
||||||
function common_memcache()
|
|
||||||
{
|
|
||||||
return Cache::instance();
|
|
||||||
}
|
|
||||||
|
|
||||||
function common_license_terms($uri)
|
function common_license_terms($uri)
|
||||||
{
|
{
|
||||||
if(preg_match('/creativecommons.org\/licenses\/([^\/]+)/', $uri, $matches)) {
|
if(preg_match('/creativecommons.org\/licenses\/([^\/]+)/', $uri, $matches)) {
|
||||||
|
|
|
@ -384,7 +384,7 @@ class GeonamesPlugin extends Plugin
|
||||||
|
|
||||||
function getCache($attrs)
|
function getCache($attrs)
|
||||||
{
|
{
|
||||||
$c = common_memcache();
|
$c = Cache::instance();
|
||||||
|
|
||||||
if (empty($c)) {
|
if (empty($c)) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -399,7 +399,7 @@ class GeonamesPlugin extends Plugin
|
||||||
|
|
||||||
function setCache($attrs, $loc)
|
function setCache($attrs, $loc)
|
||||||
{
|
{
|
||||||
$c = common_memcache();
|
$c = Cache::instance();
|
||||||
|
|
||||||
if (empty($c)) {
|
if (empty($c)) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -126,7 +126,7 @@ class LdapCommon
|
||||||
}
|
}
|
||||||
throw new Exception('Could not connect to LDAP server: '.$err->getMessage());
|
throw new Exception('Could not connect to LDAP server: '.$err->getMessage());
|
||||||
}
|
}
|
||||||
$c = common_memcache();
|
$c = Cache::instance();
|
||||||
if (!empty($c)) {
|
if (!empty($c)) {
|
||||||
$cacheObj = new MemcacheSchemaCache(
|
$cacheObj = new MemcacheSchemaCache(
|
||||||
array('c'=>$c,
|
array('c'=>$c,
|
||||||
|
|
|
@ -119,7 +119,7 @@ class MinifyPlugin extends Plugin
|
||||||
function onStartInlineScriptElement($action,&$code,&$type)
|
function onStartInlineScriptElement($action,&$code,&$type)
|
||||||
{
|
{
|
||||||
if($this->minifyInlineJs && $type=='text/javascript'){
|
if($this->minifyInlineJs && $type=='text/javascript'){
|
||||||
$c = common_memcache();
|
$c = Cache::instance();
|
||||||
if (!empty($c)) {
|
if (!empty($c)) {
|
||||||
$cacheKey = common_cache_key(self::cacheKey . ':' . crc32($code));
|
$cacheKey = common_cache_key(self::cacheKey . ':' . crc32($code));
|
||||||
$out = $c->get($cacheKey);
|
$out = $c->get($cacheKey);
|
||||||
|
@ -139,7 +139,7 @@ class MinifyPlugin extends Plugin
|
||||||
function onStartStyleElement($action,&$code,&$type,&$media)
|
function onStartStyleElement($action,&$code,&$type,&$media)
|
||||||
{
|
{
|
||||||
if($this->minifyInlineCss && $type=='text/css'){
|
if($this->minifyInlineCss && $type=='text/css'){
|
||||||
$c = common_memcache();
|
$c = Cache::instance();
|
||||||
if (!empty($c)) {
|
if (!empty($c)) {
|
||||||
$cacheKey = common_cache_key(self::cacheKey . ':' . crc32($code));
|
$cacheKey = common_cache_key(self::cacheKey . ':' . crc32($code));
|
||||||
$out = $c->get($cacheKey);
|
$out = $c->get($cacheKey);
|
||||||
|
|
|
@ -74,7 +74,7 @@ class MinifyAction extends Action
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
$c = common_memcache();
|
$c = Cache::instance();
|
||||||
if (!empty($c)) {
|
if (!empty($c)) {
|
||||||
$cacheKey = common_cache_key(MinifyPlugin::cacheKey . ':' . $this->file . '?v=' . empty($this->v)?'':$this->v);
|
$cacheKey = common_cache_key(MinifyPlugin::cacheKey . ':' . $this->file . '?v=' . empty($this->v)?'':$this->v);
|
||||||
$out = $c->get($cacheKey);
|
$out = $c->get($cacheKey);
|
||||||
|
|
|
@ -55,7 +55,7 @@ if (!empty($karg)) {
|
||||||
|
|
||||||
print "Clearing key '$k'...";
|
print "Clearing key '$k'...";
|
||||||
|
|
||||||
$c = common_memcache();
|
$c = Cache::instance();
|
||||||
|
|
||||||
if (empty($c)) {
|
if (empty($c)) {
|
||||||
die("Can't initialize cache object!\n");
|
die("Can't initialize cache object!\n");
|
||||||
|
|
|
@ -46,7 +46,7 @@ if ($start_at) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$cnt = $user->find();
|
$cnt = $user->find();
|
||||||
$cache = common_memcache();
|
$cache = Cache::instance();
|
||||||
|
|
||||||
while ($user->fetch()) {
|
while ($user->fetch()) {
|
||||||
common_log(LOG_INFO, 'Updating inbox for user ' . $user->id);
|
common_log(LOG_INFO, 'Updating inbox for user ' . $user->id);
|
||||||
|
|
|
@ -55,7 +55,7 @@ if (!empty($karg)) {
|
||||||
|
|
||||||
print "Checking key '$k'...\n";
|
print "Checking key '$k'...\n";
|
||||||
|
|
||||||
$c = common_memcache();
|
$c = Cache::instance();
|
||||||
|
|
||||||
if (empty($c)) {
|
if (empty($c)) {
|
||||||
die("Can't initialize cache object!\n");
|
die("Can't initialize cache object!\n");
|
||||||
|
|
|
@ -34,7 +34,7 @@ common_log(LOG_INFO, 'Updating user inboxes.');
|
||||||
|
|
||||||
$ids = file($id_file);
|
$ids = file($id_file);
|
||||||
|
|
||||||
$memc = common_memcache();
|
$memc = Cache::instance();
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user