chore: complete update
This commit is contained in:
41
.archive/Archived/CacheStrategy.php
Normal file
41
.archive/Archived/CacheStrategy.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Archive\Archived;
|
||||
|
||||
enum CacheStrategy: string
|
||||
{
|
||||
case STATIC = 'static';
|
||||
case PARTIAL = 'partial';
|
||||
case FRAGMENT = 'fragment';
|
||||
case DYNAMIC = 'dynamic';
|
||||
case DISABLED = 'disabled';
|
||||
|
||||
public function getTtl(): int
|
||||
{
|
||||
return match($this) {
|
||||
self::STATIC => 3600, // 1 Stunde für statische Inhalte
|
||||
self::PARTIAL => 900, // 15 Minuten für teilweise dynamische Inhalte
|
||||
self::FRAGMENT => 300, // 5 Minuten für Fragment-Cache
|
||||
self::DYNAMIC => 0, // Keine Caching für dynamische Inhalte
|
||||
self::DISABLED => 0, // Caching deaktiviert
|
||||
};
|
||||
}
|
||||
|
||||
public function getPriority(): int
|
||||
{
|
||||
return match($this) {
|
||||
self::STATIC => 1,
|
||||
self::PARTIAL => 2,
|
||||
self::FRAGMENT => 3,
|
||||
self::DYNAMIC => 4,
|
||||
self::DISABLED => 5,
|
||||
};
|
||||
}
|
||||
|
||||
public function shouldCache(): bool
|
||||
{
|
||||
return $this !== self::DYNAMIC && $this !== self::DISABLED;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user