Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache warmup #1

Closed
wants to merge 6 commits into from
Closed

Cache warmup #1

wants to merge 6 commits into from

Conversation

DieterHolvoet
Copy link
Contributor

No description provided.

Comment on lines 110 to 134
public function getByTags(array $tags): array
{
if (!$tags) {
return [];
}

$q = $this->db->select(self::TABLE_ENTRIES, 'c')
->fields('c', ['id']);
->fields('c', []);
$q->condition('c.expiry', time(), '>=');
$q->innerJoin(self::TABLE_TAGS, 't', 't.id = c.id');
$q->condition('t.tag', $tags, 'IN');

$ids = $q->execute()->fetchAll(\PDO::FETCH_COLUMN);
return $ids;
return array_map(
static function (array $data) {
return new Cache(
$data['id'],
$data['uri'],
$data['method'],
$data['content'],
unserialize($data['headers'], ['allowed_classes' => false]),
$data['expiry']
);
},
$q->execute()->fetchAll(\PDO::FETCH_ASSOC)
);
Copy link
Contributor

@RobinHoutevelts RobinHoutevelts Nov 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't load all content here. When a cache tag that is shown on all pages is invalidated you are now loading all cached pages in memory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants