Explorer
home
/
zoteqbgb
/
public_html
/
vendor
/
nette
/
caching
/
src
/
Bridges
/
CacheLatte
Location:
/home/zoteqbgb/public_html/vendor/nette/caching/src/Bridges/CacheLatte
Root path:
/home/zoteqbgb/public_html/config/676626
Editing: CacheExtension.php
<?php /** * This file is part of the Nette Framework (https://nette.org) * Copyright (c) 2004 David Grudl (https://davidgrudl.com) */ declare(strict_types=1); namespace Nette\Bridges\CacheLatte; use Latte; use Latte\Compiler\Nodes\AuxiliaryNode; use Latte\Compiler\Nodes\TemplateNode; use Latte\Compiler\Tag; use Nette\Caching\Storage; /** * Latte v3 extension for Nette Caching */ final class CacheExtension extends Latte\Extension { private bool $used; private Storage $storage; public function __construct(Storage $storage) { $this->storage = $storage; } public function beforeCompile(Latte\Engine $engine): void { $this->used = false; } public function getTags(): array { return [ 'cache' => function (Tag $tag): \Generator { $this->used = true; return yield from Nodes\CacheNode::create($tag); }, ]; } public function getPasses(): array { return [ 'cacheInitialization' => function (TemplateNode $node): void { if ($this->used) { $node->head->append(new AuxiliaryNode(fn() => '$this->global->cache->initialize($this);')); } }, ]; } public function getProviders(): array { return [ 'cache' => new Runtime($this->storage), ]; } public function getCacheKey(Latte\Engine $engine): array { return ['version' => 2]; } }
Save maftirs
Upload
Start Upload
New File
Create File
New Folder
Create Folder
Directory Contents
Name
Size
Perms
Modified
Actions
CacheExtension.php
1,316 bytes
0644
2024-08-07 05:01
âï¸
ðï¸
Rename
CacheMacro.php
3,747 bytes
0644
2024-08-07 05:01
âï¸
ðï¸
Rename
Nodes
-
0755
2024-08-07 05:01
ðï¸
Rename
Runtime.php
1,978 bytes
0644
2024-08-07 05:01
âï¸
ðï¸
Rename
Chang
Apply