<commit_before><?php

namespace Opifer\ContentBundle\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * Class BlockRepository
 *
 * @package Opifer\ContentBundle\Model
 */
class BlockRepository extends EntityRepository
{

}<commit_msg>Added a way to find cached blocks by id<commit_after><?php

namespace Opifer\ContentBundle\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * Class BlockRepository
 *
 * @package Opifer\ContentBundle\Model
 */
class BlockRepository extends EntityRepository
{
    public function findCached($id)
    {
        return $this->createQueryBuilder('b')
            ->where('b.id = :id')
            ->setParameter('id', $id)
            ->getQuery()
            ->useResultCache(true)
            ->setResultCacheLifetime(86400)
            ->getOneOrNullResult();
    }
}

{'fraction_non_alphanumeric': 0.11576354679802955, 'fraction_numerical': 0.006157635467980296, 'mean_word_length': 3.169230769230769, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, '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': '4507193', 'n_tokens_mistral': 231, 'n_tokens_neox': 228, 'n_words': 47}