<commit_before><?php

namespace AppBundle\Repository;

class PostRepository extends AbstractRepository
{
    public function findAllOrByTag($limit, $page, $tagSlug = null)
    {
        $qb = $this->createQueryBuilder('u')
            ->setMaxResults($limit)
            ->setFirstResult($page)
            ->orderBy('u.createdAt', 'DESC')
        ;

        if ($tagSlug) {
            $qb->join('u.tags', 't')->andWhere('t.slug = :slug')->setParameter('slug', $tagSlug);
        }

        $query = $qb->getQuery();

        return $query->execute();
    }
}<commit_msg>Added Doctrine result cache to findAllOrByTag method<commit_after><?php

namespace AppBundle\Repository;

class PostRepository extends AbstractRepository
{
    public function findAllOrByTag($limit, $page, $tagSlug = null)
    {
        $qb = $this->createQueryBuilder('u')
            ->setMaxResults($limit)
            ->setFirstResult($page)
            ->orderBy('u.createdAt', 'DESC')
        ;

        if ($tagSlug) {
            $qb->join('u.tags', 't')->andWhere('t.slug = :slug')->setParameter('slug', $tagSlug);
        }

        $query = $qb->getQuery();

        $query->useResultCache(true, 3600);

        return $query->execute();
    }
}
{'fraction_non_alphanumeric': 0.16368078175895764, 'fraction_numerical': 0.003257328990228013, 'mean_word_length': 2.5214899713467047, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '966889', 'n_tokens_mistral': 384, 'n_tokens_neox': 380, 'n_words': 66}