PHP code example of emirustaoglu / filecache

1. Go to this page and download the library: Download emirustaoglu/filecache library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

emirustaoglu / filecache example snippets


use emirustaoglu\filecache;

/**
 * @string $cacheDir Cache dizinini belirtiniz.
 * @int $cacheMinutes Cache dosyalarınız için dakika bazında süre belirtiniz. Bu süre default olarak 1 gündür
 * @bool $base64 Cache yapısında dosya isminin base64 olarak şifrelenip şifrelenmeyeceğini belirtiniz.
 */
$cache = new FileCache(__DIR__ . "/cache/", 1440, false);

//Cache Dosyası Oluşturma

/**
 * @array $data Ddatanız. Bu değer Cache dosyasına yazılacaktır.
 * @string $cacheName Cache Dosya adını belirtiniz.
 * @return bool
 */
if ($cache->createCache($data, "currencyCache")) {
    //... cache dosyası yazıldı
} else {
    //... cache dosyası yazılamadı
}

//Cache verisini çekme
/**
 * @string $cacheName Okunacak Cache dosya adını veriniz.
 * @return false|mixed
 */
$getCache = $cache->getCache("currencyCache");

print_r($getCache);