Last active
August 29, 2015 14:14
-
-
Save silverslice/9b0a0ad555f073330be2 to your computer and use it in GitHub Desktop.
Bluz file cache test code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Environment | |
define('DEBUG', false); | |
error_reporting(E_ALL | E_STRICT); | |
ini_set('display_errors', 1); | |
// Paths | |
define('PATH_ROOT', realpath(dirname(__FILE__). '/../')); | |
define('PATH_APPLICATION', PATH_ROOT . '/cachetest'); | |
define('PATH_VENDOR', PATH_ROOT . '/vendor'); | |
// init autoloader | |
require_once PATH_ROOT . '/vendor/autoload.php'; | |
use Bluz\Cache\Cache; | |
$settings = [ | |
"adapter" => "phpFile", | |
"settings" => [ | |
"phpFile" => [ | |
"cacheDir" => PATH_APPLICATION .'/cache' | |
] | |
] | |
]; | |
$cache = new Cache(); | |
$cache->setOptions($settings); | |
$val = file_get_contents('content.txt'); // ~100KB | |
$key = 'test-237'; | |
$res = $cache->get($key); | |
if (!$res) { | |
$cache->set($key, $val, 3); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment