Merge pull request #8072 from nupplaphil/task/Cache_to_DI

Replace Core\Cache wrapper with DI::cache() method
This commit is contained in:
Hypolite Petovan 2020-01-10 08:46:03 -05:00 committed by GitHub
commit 36190d1e79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 60 additions and 168 deletions

View file

@ -5,7 +5,6 @@
namespace Friendica\Worker;
use Friendica\App;
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
@ -154,7 +153,7 @@ class CronJobs
}
// clear old cache
Cache::clear();
DI::cache()->clear();
// clear old item cache files
clear_cache();

View file

@ -4,12 +4,13 @@
*/
namespace Friendica\Worker;
use Friendica\Core\Cache;
use Friendica\Core\Cache\Cache;
use Friendica\Core\Config;
use Friendica\Core\Logger;
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;
@ -26,7 +27,7 @@ class SearchDirectory
return;
}
$data = Cache::get('SearchDirectory:' . $search);
$data = DI::cache()->get('SearchDirectory:' . $search);
if (!is_null($data)) {
// Only search for the same item every 24 hours
if (time() < $data + (60 * 60 * 24)) {
@ -80,6 +81,6 @@ class SearchDirectory
}
}
}
Cache::set('SearchDirectory:' . $search, time(), Cache::DAY);
DI::cache()->set('SearchDirectory:' . $search, time(), Cache::DAY);
}
}