forked from halo-battle/game
Version 1.12
This commit is contained in:
parent
2a066a7498
commit
de31cd3e9a
1373 changed files with 156282 additions and 45238 deletions
35
onyx2/require/cache.php
Normal file
35
onyx2/require/cache.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
class Cache
|
||||
{
|
||||
|
||||
function set($id,$var)
|
||||
{
|
||||
$file = '<?php $cache = '.var_export($var,TRUE).'; ?>';
|
||||
|
||||
file_put_contents(ONYX.'cache/'.md5($id).'.cache.php',$file) or trigger_error('dossier cache inaccessible en écriture.',E_USER_ERROR);
|
||||
}
|
||||
|
||||
function read($id)
|
||||
{
|
||||
if(!is_readable(ONYX.'cache/'.md5($id).'.cache.php')) return FALSE;
|
||||
|
||||
include(ONYX.'cache/'.md5($id).'.cache.php');
|
||||
if(!$cache) return FALSE;
|
||||
return $cache;
|
||||
}
|
||||
|
||||
function del($id)
|
||||
{
|
||||
if(!is_file(ONYX.'cache/'.md5($id).'.cache.php')) return FALSE;
|
||||
return unlink(ONYX.'cache/'.md5($id).'.cache.php');
|
||||
}
|
||||
|
||||
function flush()
|
||||
{
|
||||
foreach(glob(ONYX.'cache/*.cache.php') as $file) unlink($file);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue