]> git.mxchange.org Git - friendica-addons.git/commitdiff
[advancedcontentfilter] Enable rule caching
authorBenjamin Lorteau <benjamin.lorteau@cbsinteractive.com>
Fri, 10 Jan 2020 19:05:27 +0000 (14:05 -0500)
committerBenjamin Lorteau <benjamin.lorteau@cbsinteractive.com>
Fri, 10 Jan 2020 19:05:27 +0000 (14:05 -0500)
- Fix broken reference to Friendica\Core\Cache

advancedcontentfilter/advancedcontentfilter.php

index 8aaa7cf754e23719b6ed705ea9ab9ff94881e9b2..26227c21f777d454c55faaedfd95fcd1e7b6bbc7 100644 (file)
 use Friendica\App;
 use Friendica\BaseModule;
 use Friendica\Content\Text\Markdown;
-use Friendica\Core\Cache;
 use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
 use Friendica\Database\DBStructure;
+use Friendica\DI;
 use Friendica\Model\Item;
 use Friendica\Model\Term;
 use Friendica\Module\Security\Login;
@@ -114,13 +114,15 @@ function advancedcontentfilter_prepare_body_content_filter(App $a, &$hook_data)
                $vars[str_replace('-', '_', $key)] = $value;
        }
 
-       $rules = Cache::get('rules_' . local_user());
+       $rules = DI::cache()->get('rules_' . local_user());
        if (!isset($rules)) {
                $rules = DBA::toArray(DBA::select(
                        'advancedcontentfilter_rules',
                        ['name', 'expression', 'serialized'],
                        ['uid' => local_user(), 'active' => true]
                ));
+
+               DI::cache()->set('rules_' . local_user(), $rules);
        }
 
        if ($rules) {