DBA::escape(DateTimeFormat::utcNow())
);
if (DBA::isResult($ev)) {
- Cache::set($cachekey, $ev, Cache::HOUR);
+ DI::cache()->set($cachekey, $ev, Cache::HOUR);
}
}
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Protocol\PortableContact;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings;
$about = Cache::get("about:" . $contact['updated'] . ":" . $contact['nurl']);
if (is_null($about)) {
$about = BBCode::convert($contact['about'], false);
- Cache::set("about:" . $contact['updated'] . ":" . $contact['nurl'], $about);
+ DI::cache()->set("about:" . $contact['updated'] . ":" . $contact['nurl'], $about);
}
// Non connected persons can only see the keywords of a Diaspora account
$cache_ttl = Cache::FIVE_MINUTES;
}
- Cache::set($cache_key, $json_string, $cache_ttl);
+ DI::cache()->set($cache_key, $json_string, $cache_ttl);
}
if ($oembed->type == 'error') {
}
}
}
- Cache::set($cache_key, $text);
+ DI::cache()->set($cache_key, $text);
}
return $text;
}
}
}
- Cache::set($cache_key, $text);
+ DI::cache()->set($cache_key, $text);
return $text;
}
{
return DI::cache()->get($key);
}
-
- /**
- * @brief Put data in the cache according to the key
- *
- * The input $value can have multiple formats.
- *
- * @param string $key The key to the cached data
- * @param mixed $value The value that is about to be stored
- * @param integer $duration The cache lifespan
- *
- * @return bool
- * @throws \Exception
- */
- public static function set($key, $value, $duration = CacheClass::MONTH)
- {
- return DI::cache()->set($key, $value, $duration);
- }
}
DBA::escape(L10n::t("Contact Photos"))
);
}
- Cache::set($key, $albums, Cache::DAY);
+ DI::cache()->set($key, $albums, Cache::DAY);
}
return $albums;
}
public static function clearAlbumCache($uid)
{
$key = "photo_albums:".$uid.":".local_user().":".remote_user();
- Cache::set($key, null, Cache::DAY);
+ DI::cache()->set($key, null, Cache::DAY);
}
/**
);
if (DBA::isResult($s)) {
$r = DBA::toArray($s);
- Cache::set($cachekey, $r, Cache::HOUR);
+ DI::cache()->set($cachekey, $r, Cache::HOUR);
}
}
Logger::log('URL ' . $my_url . ' already tried to authenticate.', Logger::DEBUG);
return;
} else {
- Cache::set($cachekey, true, Cache::MINUTE);
+ DI::cache()->set($cachekey, true, Cache::MINUTE);
}
Logger::log('Not authenticated. Invoking reverse magic-auth for ' . $my_url, Logger::DEBUG);
if (DBA::isResult($tagsStmt)) {
$tags = DBA::toArray($tagsStmt);
- Cache::set('global_trending_tags', $tags, Cache::HOUR);
+ DI::cache()->set('global_trending_tags', $tags, Cache::HOUR);
}
}
if (DBA::isResult($tagsStmt)) {
$tags = DBA::toArray($tagsStmt);
- Cache::set('local_trending_tags', $tags, Cache::HOUR);
+ DI::cache()->set('local_trending_tags', $tags, Cache::HOUR);
}
}
if (($resultdata->time > (time() - $crawl_permit_period)) && ($resultdata->accesses > $free_crawls)) {
throw new HTTPException\TooManyRequestsException(L10n::t('Only one search per minute is permitted for not logged in users.'));
}
- Cache::set('remote_search:' . $remote, json_encode(['time' => time(), 'accesses' => $resultdata->accesses + 1]), CacheClass::HOUR);
+ DI::cache()->set('remote_search:' . $remote, json_encode(['time' => time(), 'accesses' => $resultdata->accesses + 1]), CacheClass::HOUR);
} else {
- Cache::set('remote_search:' . $remote, json_encode(['time' => time(), 'accesses' => 1]), CacheClass::HOUR);
+ DI::cache()->set('remote_search:' . $remote, json_encode(['time' => time(), 'accesses' => 1]), CacheClass::HOUR);
}
}
// Only store into the cache if the value seems to be valid
if (!in_array($data['network'], [Protocol::PHANTOM, Protocol::MAIL])) {
- Cache::set('Probe::uri:' . $network . ':' . $uri, $data, Cache::DAY);
+ DI::cache()->set('Probe::uri:' . $network . ':' . $uri, $data, Cache::DAY);
}
return $data;
$data = ActivityPub\Transmitter::createActivityFromItem($item_id);
- Cache::set($cachekey, $data, Cache::QUARTER_HOUR);
+ DI::cache()->set($cachekey, $data, Cache::QUARTER_HOUR);
return $data;
}
Logger::log("Send participation for ".$item["guid"]." by ".$author, Logger::DEBUG);
// It doesn't matter what we store, we only want to avoid sending repeated notifications for the same item
- Cache::set($cachekey, $item["guid"], Cache::QUARTER_HOUR);
+ DI::cache()->set($cachekey, $item["guid"], Cache::QUARTER_HOUR);
return self::buildAndTransmit($owner, $contact, "participation", $message);
}
$msg = ["type" => $type, "message" => $message];
- Cache::set($cachekey, $msg, Cache::QUARTER_HOUR);
+ DI::cache()->set($cachekey, $msg, Cache::QUARTER_HOUR);
return $msg;
}
$comment['thread_parent_guid'] = $thread_parent_item['guid'];
}
- Cache::set($cachekey, $comment, Cache::QUARTER_HOUR);
+ DI::cache()->set($cachekey, $comment, Cache::QUARTER_HOUR);
return($comment);
}
$feeddata = trim($doc->saveXML());
$msg = ['feed' => $feeddata, 'last_update' => $last_update];
- Cache::set($cachekey, $msg, Cache::QUARTER_HOUR);
+ DI::cache()->set($cachekey, $msg, Cache::QUARTER_HOUR);
Logger::log('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created, Logger::DEBUG);
if (empty($data) || !is_array($data)) {
$data = self::getInfoFromURL($url);
- Cache::set($url, $data);
+ DI::cache()->set($url, $data);
}
return $data;
use Friendica\Core\Cache;
use Friendica\Core\Logger;
use Exception;
+use Friendica\DI;
/**
* @brief This class contain methods to work with JsonLD data
}
$data = jsonld_default_document_loader($url);
- Cache::set('documentLoader:' . $url, $data, Cache::DAY);
+ DI::cache()->set('documentLoader:' . $url, $data, Cache::DAY);
return $data;
}
use Friendica\Core\Protocol;
use Friendica\Core\Search;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\GContact;
use Friendica\Model\GServer;
use Friendica\Network\Probe;
}
}
}
- Cache::set('SearchDirectory:' . $search, time(), Cache::DAY);
+ DI::cache()->set('SearchDirectory:' . $search, time(), Cache::DAY);
}
}