return null;
}
- $cache = common_memcache();
+ $cache = Cache::instance();
if($cache) {
$key = common_cache_key('attachments:etag:' . $this->path);
$etag = $cache->get($key);
}
static function memcache() {
- return common_memcache();
+ return Cache::instance();
}
static function cacheKey($cls, $k, $v) {
function getStreamByIds($ids)
{
- $cache = common_memcache();
+ $cache = Cache::instance();
if (!empty($cache)) {
$notices = array();
function stream($fn, $args, $cachekey, $offset=0, $limit=20, $since_id=0, $max_id=0)
{
- $cache = common_memcache();
+ $cache = Cache::instance();
if (empty($cache) ||
$since_id != 0 || $max_id != 0 ||
function repeatStream($limit=100)
{
- $cache = common_memcache();
+ $cache = Cache::instance();
if (empty($cache)) {
$ids = $this->_repeatStreamDirect($limit);
function subscriptionCount()
{
- $c = common_memcache();
+ $c = Cache::instance();
if (!empty($c)) {
$cnt = $c->get(common_cache_key('profile:subscription_count:'.$this->id));
function subscriberCount()
{
- $c = common_memcache();
+ $c = Cache::instance();
if (!empty($c)) {
$cnt = $c->get(common_cache_key('profile:subscriber_count:'.$this->id));
if (is_integer($cnt)) {
function faveCount()
{
- $c = common_memcache();
+ $c = Cache::instance();
if (!empty($c)) {
$cnt = $c->get(common_cache_key('profile:fave_count:'.$this->id));
if (is_integer($cnt)) {
function noticeCount()
{
- $c = common_memcache();
+ $c = Cache::instance();
if (!empty($c)) {
$cnt = $c->get(common_cache_key('profile:notice_count:'.$this->id));
function blowSubscriberCount()
{
- $c = common_memcache();
+ $c = Cache::instance();
if (!empty($c)) {
$c->delete(common_cache_key('profile:subscriber_count:'.$this->id));
}
function blowSubscriptionCount()
{
- $c = common_memcache();
+ $c = Cache::instance();
if (!empty($c)) {
$c->delete(common_cache_key('profile:subscription_count:'.$this->id));
}
function blowFaveCount()
{
- $c = common_memcache();
+ $c = Cache::instance();
if (!empty($c)) {
$c->delete(common_cache_key('profile:fave_count:'.$this->id));
}
function blowNoticeCount()
{
- $c = common_memcache();
+ $c = Cache::instance();
if (!empty($c)) {
$c->delete(common_cache_key('profile:notice_count:'.$this->id));
}
function hasFave($notice)
{
- $cache = common_memcache();
+ $cache = Cache::instance();
// XXX: Kind of a hack.
function blowFavesCache()
{
- $cache = common_memcache();
+ $cache = Cache::instance();
if ($cache) {
// Faves don't happen chronologically, so we need to blow
// ;last cache, too
// Reconnect main memcached, or threads will stomp on
// each other and corrupt their requests.
- $cache = common_memcache();
+ $cache = Cache::instance();
if ($cache) {
$cache->reconnect();
}
function incDeliveryCount($msgId)
{
$count = 0;
- $cache = common_memcache();
+ $cache = Cache::instance();
if ($cache) {
$key = 'statusnet:stomp:message-retries:' . $msgId;
$count = $cache->increment($key);
/**
* This should only be used at setup; processes switching languages
* to send text to other users should use common_switch_locale().
- *
+ *
* @param string $language Locale language code (optional; empty uses
* current user's preference or site default)
* @return mixed success
/**
* Initialize locale and charset settings and gettext with our message catalog,
* using the current user's language preference or the site default.
- *
+ *
* This should generally only be run at framework initialization; code switching
* languages at runtime should call common_switch_language().
- *
+ *
* @access private
*/
function common_init_language()
textdomain("statusnet");
}
-
function common_timezone()
{
if (common_logged_in()) {
/**
* Record the given URL as the return destination for a future
* form submission, to be read by common_get_returnto().
- *
+ *
* @param string $url
- *
+ *
* @fixme as a session-global setting, this can allow multiple forms
* to conflict and overwrite each others' returnto destinations if
* the user has multiple tabs or windows open.
- *
+ *
* Should refactor to index with a token or otherwise only pass the
* data along its intended path.
*/
/**
* Fetch a return-destination URL previously recorded by
* common_set_returnto().
- *
+ *
* @return mixed URL string or null
- *
+ *
* @fixme as a session-global setting, this can allow multiple forms
* to conflict and overwrite each others' returnto destinations if
* the user has multiple tabs or windows open.
- *
+ *
* Should refactor to index with a token or otherwise only pass the
* data along its intended path.
*/
return Cache::keyize($str);
}
-function common_memcache()
-{
- return Cache::instance();
-}
-
function common_license_terms($uri)
{
if(preg_match('/creativecommons.org\/licenses\/([^\/]+)/', $uri, $matches)) {
function getCache($attrs)
{
- $c = common_memcache();
+ $c = Cache::instance();
if (empty($c)) {
return null;
function setCache($attrs, $loc)
{
- $c = common_memcache();
+ $c = Cache::instance();
if (empty($c)) {
return null;
}
throw new Exception('Could not connect to LDAP server: '.$err->getMessage());
}
- $c = common_memcache();
+ $c = Cache::instance();
if (!empty($c)) {
$cacheObj = new MemcacheSchemaCache(
array('c'=>$c,
function onStartInlineScriptElement($action,&$code,&$type)
{
if($this->minifyInlineJs && $type=='text/javascript'){
- $c = common_memcache();
+ $c = Cache::instance();
if (!empty($c)) {
$cacheKey = common_cache_key(self::cacheKey . ':' . crc32($code));
$out = $c->get($cacheKey);
function onStartStyleElement($action,&$code,&$type,&$media)
{
if($this->minifyInlineCss && $type=='text/css'){
- $c = common_memcache();
+ $c = Cache::instance();
if (!empty($c)) {
$cacheKey = common_cache_key(self::cacheKey . ':' . crc32($code));
$out = $c->get($cacheKey);
{
parent::handle($args);
- $c = common_memcache();
+ $c = Cache::instance();
if (!empty($c)) {
$cacheKey = common_cache_key(MinifyPlugin::cacheKey . ':' . $this->file . '?v=' . empty($this->v)?'':$this->v);
$out = $c->get($cacheKey);
print "Clearing key '$k'...";
-$c = common_memcache();
+$c = Cache::instance();
if (empty($c)) {
die("Can't initialize cache object!\n");
}
$cnt = $user->find();
-$cache = common_memcache();
+$cache = Cache::instance();
while ($user->fetch()) {
common_log(LOG_INFO, 'Updating inbox for user ' . $user->id);
print "Checking key '$k'...\n";
-$c = common_memcache();
+$c = Cache::instance();
if (empty($c)) {
die("Can't initialize cache object!\n");
$ids = file($id_file);
-$memc = common_memcache();
+$memc = Cache::instance();
foreach ($ids as $id) {