mlevent / file-cache
PHP için basit dosya tipi cache paketi.
Installs: 10
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/mlevent/file-cache
Requires
- php: ^8.0
This package is auto-updated.
Last update: 2025-09-29 03:07:12 UTC
README
PHP için basit, dosya tipi önbellek sınıfı.
Kurulum
🛠️ Paketi composer ile projenize dahil edin;
composer require mlevent/file-cache
Örnek Kullanım
use Mlevent\FileCache\FileCache; $cache = new FileCache; $updatedTime = $cache->refresh('updatedTime', function () { return date("H:i:s"); }, 60); echo "Updated time: {$updatedTime}";
Önbellek dosyaları varsayılan olarak ./cache
dizininde saklanır;
$ tree ./cache
./cache
└── f7
└── d1
└── 7411a1eeb3dabcc2311f04eeb5371f0f40f192f3.cache
Geleneksel kullanım şekline örnek olarak;
use Mlevent\FileCache\FileCache; // Önbellek dosyaları ./cache dizininde saklanacak $cache = new FileCache('./cache'); // Geçerlilik süresi dolduysa if ($cache->isExpired('updatedTime')) { // Geçerlilik süresini 60 saniye daha uzat ve yeni veriyi yaz $cache->put('updatedTime', date("H:i:s"), 60); } // Veriyi önbellekten oku $updatedTime = $cache->get('updatedTime'); echo "Updated time: {$updatedTime}";
/** * @return bool */ $cache->has(string $name); /** * @return bool */ $cache->delete(string $name); /** * @return void */ $cache->flush(); /** * @return array */ $cache->getStore();
📧İletişim
İletişim için ghergedan@gmail.com adresine e-posta gönderin.