vendor/asm89/twig-cache-extension/lib/Asm89/Twig/CacheExtension/CacheStrategy/BlackholeCacheStrategy.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

/*
 * This file is part of twig-cache-extension.
 *
 * (c) Alexander <iam.asm89@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Asm89\Twig\CacheExtension\CacheStrategy;

use Asm89\Twig\CacheExtension\CacheStrategyInterface;

/**
 * CacheStrategy which doesn't cache at all
 *
 * This strategy can be used in development mode, e.g. editing twig templates,
 * to prevent previously cached versions from being rendered.
 *
 * @see     https://github.com/asm89/twig-cache-extension/pull/29
 *
 * @author  Hagen Hübel <hhuebel@itinance.com>
 *
 * @package Asm89\Twig\CacheExtension\CacheStrategy
 */
class BlackholeCacheStrategy implements CacheStrategyInterface
{
    /**
     * {@inheritDoc}
     */
    public function fetchBlock($key)
    {
        return false;
    }

    /**
     * {@inheritDoc}
     */
    public function generateKey($annotation, $value)
    {
        return microtime(true) . mt_rand();
    }

    /**
     * {@inheritDoc}
     */
    public function saveBlock($key, $block)
    {
        // fire and forget
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。