Cache all terms of a content (only ids)

@return array
549909
private function cacheTermsForContent()
    {
        $term_container = (new TermContainer)->getTable();
        $terms = $this->taxonomies()
            ->select("$term_container.id", "$term_container.vocabulary_id")
            ->get();

        if (!count($terms)) {
            return [];
        }

        $results = [];
        foreach ($terms as $term) {
            $results[$term->vocabulary_id][] = $term->id;
        }

        // a whole week, because it's automatically recached
        Cache::put($this->getTaxonomyCacheKey(), $results, 60 * 24 * 7);

        return $results;
    }
950674
private function cachedAllSimple() {
		if (!isset($this->{__METHOD__})) {
			$this->{__METHOD__} = array_merge($this->cachedI(), $this->cachedGlobalI());
		}
		return $this->{__METHOD__};
	}
749913
public function all($id = null)
    {
        if (!is_int($id)) {
            return $this->get('/repositories');
        }

        return $this->get('/repositories?since='.rawurldecode($id));
    }
998822
public function getCachedContent()
    {
        if ($this->_content === null) {
            $this->_content = false;
            if ($this->cache instanceof Cache) {
                $key = $this->calculateKey();
                $data = $this->cache->get($key);
                if (is_array($data) && count($data) === 2) {
                    list ($content, $placeholders) = $data;
                    if (is_array($placeholders) && count($placeholders) > 0) {
                        if (empty($this->getView()->cacheStack)) {
                            // outermost cache: replace placeholder with dynamic content
                            $content = $this->updateDynamicContent($content, $placeholders);
                        }
                        foreach ($placeholders as $name => $statements) {
                            $this->getView()->addDynamicPlaceholder($name, $statements);
                        }
                    }
                    $this->_content = $content;
                }
            }
        }

        return $this->_content;
    }
744457
public function detailCacheAll($id){
        $sentence = new SentenceUtil();
        $sentence->fromCommand("/ip/dns/cache/all/print");
        $sentence->where(".id", "=", $id);
        $this->talker->send($sentence);
        $rs = $this->talker->getResult();
        $i = 0 ;
        if ($i < $rs->size()){
            return $rs->getResultArray();
        }  else {
            return "No Ip DNS Cache All With This Id = ".$id;
        }
    }
732654
public function getContentItemArray()
    {
        return [
            'content' => $this->content,
            'id' => $this->id,
            'created' => $this->created,
            'updated' => $this->updated,
            'contenttype' => $this->contenttype,
            'language' => $this->language,
            'parentid' => $this->parentid,
            'reply' => $this->reply,
            'forward' => $this->forward,
        ];
    }
758979
public function getSearchResults()
    {
        $term = $this->getRequest()->get('search', null);

        // Avoid querying ALL content when no search value is provided
        if (!$term) {
            return [];
        }

        $host = $this->getRequest()->getHost();
        $locale = $this->getRequest()->attributes->get('content')->getLocale();

        return $this->contentManager->getRepository()->search($term, $host, $locale);
    }
1234766
public function getCacheContents()
    {
        $cacheFile = $this->getCacheFile();

        if ( ! file_exists($cacheFile)) {
            return false;
        }

        return json_decode($this->sharedGet($cacheFile), true) ?? [];
    }
641313
public function all()
    {
        $entries = [];
        while ($keys = $this->redis->scan($it, self::KEY_PREFIX.'*')) {
            foreach ($keys as $key) {
                $entries[substr($key, strlen(self::KEY_PREFIX))] = Collection::make($this->redis->get($key));
            }
        }

        return $entries;
    }
420219
public function getAllLastVersion()
	{
		$qb = $this->createQueryBuilder('p');
		$qb->where('p.original IS NULL AND p.state=:state')
			->setParameter(':state', DocumentModel::STATE_PUBLISHED);
		
		$result = $qb->getQuery()->getResult();
		$return = array();
		foreach($result as $original) {
			$return[] = $this->getLastVersion($original->getId());
		}
		return $return;
	}
1113337
public function getSeoTags() {
        if($this->owner->seo) {
            $seo = $this->owner->seo->attributes;
            return array_filter(array_intersect_key($seo, array_flip(['meta_title', 'meta_keywords', 'meta_description'])));
        } else {
            return [];
        }
    }
292733
public function getAll()
    {
        $values = json_decode(file_get_contents($this->cacheFile), true);

        if( ! is_array($values)) return [];
        
        foreach ($values as $key => $value) {
            $values[$key] = unserialize($value);
        }
        return $values;
    }
1319376
public function replaceIdxContentContents(array $contents)
    {
        $parentUids = array();
        foreach ($contents as $content) {
            // avoid loop if content is already treated
            if (null === $content || true === $content->isElementContent()) {
                continue;
            } elseif (true === array_key_exists($content->getUid(), $parentUids)) {
                break;
            } elseif (false === array_key_exists($content->getUid(), $parentUids)) {
                $parentUids[$content->getUid()] = array($content->getUid());
            }

            $parentUids[$content->getUid()] = array_merge($parentUids[$content->getUid()], $this->getAClassContentUids($content->getSubcontent()->toArray()));
        }

        return $this->replaceIdxContentContentsByUids($parentUids);
    }
614510
public function findAll()
    {
        $keys = $this->getFileManager()->keys();
        $entities = array();
        if(is_array($keys)) {
            foreach($keys as $key) {
                if(preg_match('/^'.$this->getHash().'/', $key)) {
                    $entities[] = $this->loadEntity($key);
                }
            }
        }
        
        return $entities;
    }
1086453
protected function get_all_concepts() {
        global $USER;

        if ($this->cache === null) {
            $this->cache = cache::make_from_params(cache_store::MODE_REQUEST, 'filter', 'glossary');
        }

        // Try to get current course.
        $coursectx = $this->context->get_course_context(false);
        if (!$coursectx) {
            // Only global glossaries will be linked.
            $courseid = 0;
        } else {
            $courseid = $coursectx->instanceid;
        }

        $cached = $this->cache->get('concepts');
        if ($cached !== false && ($cached->cachecourseid != $courseid || $cached->cacheuserid != $USER->id)) {
            // Invalidate the page cache.
            $cached = false;
        }

        if ($cached !== false && is_array($cached->cacheconceptlist)) {
            return $cached->cacheconceptlist;
        }

        list($glossaries, $allconcepts) = \mod_glossary\local\concept_cache::get_concepts($courseid);

        if (!$allconcepts) {
            $tocache = new stdClass();
            $tocache->cacheuserid = $USER->id;
            $tocache->cachecourseid = $courseid;
            $tocache->cacheconceptlist = [];
            $this->cache->set('concepts', $tocache);
            return [];
        }

        $conceptlist = array();

        foreach ($allconcepts as $concepts) {
            foreach ($concepts as $concept) {
                $conceptlist[] = new filterobject($concept->concept, null, null,
                        $concept->casesensitive, $concept->fullmatch, null,
                        [$this, 'filterobject_prepare_replacement_callback'], [$concept, $glossaries]);
            }
        }

        // We sort longest first, so that when we replace the terms,
        // the longest ones are replaced first. This does the right thing
        // when you have two terms like 'Moodle' and 'Moodle 3.5'. You want the longest match.
        usort($conceptlist, [$this, 'sort_entries_by_length']);

        $conceptlist = filter_prepare_phrases_for_filtering($conceptlist);

        $tocache = new stdClass();
        $tocache->cacheuserid = $USER->id;
        $tocache->cachecourseid = $courseid;
        $tocache->cacheconceptlist = $conceptlist;
        $this->cache->set('concepts', $tocache);

        return $conceptlist;
    }
623157
private function getContent()
    {
        return is_array($this->content)
            ? array_map(function ($content) { return $this->clean($content); }, $this->content)
            : $this->clean($this->content);
    }
127602
public function content(): array
    {
        $dirs = collect($this->storage->allDirectories($this->root));
        $output = [];

        $dirs->filter(function ($dir) {
            $parts = $this->split($dir);
            return !in_array($parts[0], $this->exclude);
        })->each(function ($dir) use (&$output) {
            $curr = &$output;
            foreach ($this->split($dir) as $name) {
                if (!collect($curr)->contains('name', $name)) {
                    $curr[] = [
                        'path' => $this->dirToPath($dir),
                        'name' => $name,
                        'children' => []
                    ];
                } else {
                    foreach ($curr as $key => $item) {
                        if ($item['name'] === $name)
                            $curr = &$curr[$key]['children'];
                    }
                }
            }
        });

        return $output;
    }