chore: complete update
This commit is contained in:
30
.archive/Optimized/CacheAnalysis.php
Normal file
30
.archive/Optimized/CacheAnalysis.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Archive\Optimized;
|
||||
|
||||
/**
|
||||
* Cache-Analyse für Template-Rendering
|
||||
*/
|
||||
final readonly class CacheAnalysis
|
||||
{
|
||||
public function __construct(
|
||||
public CacheStrategy $strategy,
|
||||
public int $ttl,
|
||||
public array $dependencies = [],
|
||||
) {}
|
||||
|
||||
public function shouldCache(): bool
|
||||
{
|
||||
return $this->strategy !== CacheStrategy::DYNAMIC && $this->ttl > 0;
|
||||
}
|
||||
|
||||
public function isUserSpecific(): bool
|
||||
{
|
||||
return isset($this->dependencies['user_id']) || isset($this->dependencies['session_id']);
|
||||
}
|
||||
|
||||
public function getComplexity(): int
|
||||
{
|
||||
return count($this->dependencies) + ($this->isUserSpecific() ? 5 : 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user