little change in cache
parent
91c6583d70
commit
b0bee473ff
20
common.php
20
common.php
|
@ -540,14 +540,28 @@ function isHideFile($name)
|
||||||
|
|
||||||
function getcache($str)
|
function getcache($str)
|
||||||
{
|
{
|
||||||
$cache = new \Doctrine\Common\Cache\FilesystemCache(sys_get_temp_dir(), __DIR__.'/Onedrive/'.$_SERVER['disktag']);
|
$cache = filecache();
|
||||||
return $cache->fetch($str);
|
return $cache->fetch($str);
|
||||||
}
|
}
|
||||||
|
|
||||||
function savecache($key, $value, $exp = 1800)
|
function savecache($key, $value, $exp = 1800)
|
||||||
{
|
{
|
||||||
$cache = new \Doctrine\Common\Cache\FilesystemCache(sys_get_temp_dir(), __DIR__.'/Onedrive/'.$_SERVER['disktag']);
|
$cache = filecache();
|
||||||
$cache->save($key, $value, $exp);
|
return $cache->save($key, $value, $exp);
|
||||||
|
}
|
||||||
|
|
||||||
|
function filecache()
|
||||||
|
{
|
||||||
|
$dir = sys_get_temp_dir();
|
||||||
|
if (!is_writable($dir)) {
|
||||||
|
if ( is_writable(__DIR__ . '/tmp/') ) $dir = __DIR__ . '/tmp/';
|
||||||
|
if ( mkdir(__DIR__ . '/tmp/', 0777) ) $dir = __DIR__ . '/tmp/';
|
||||||
|
}
|
||||||
|
$tag = __DIR__ . '/OneManager/' . $_SERVER['disktag'];
|
||||||
|
while (strpos($tag, '/')>-1) $tag = str_replace('/', '_', $tag);
|
||||||
|
// error_log('DIR:' . $dir . ' TAG: ' . $tag);
|
||||||
|
$cache = new \Doctrine\Common\Cache\FilesystemCache($dir, $tag);
|
||||||
|
return $cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getconstStr($str)
|
function getconstStr($str)
|
||||||
|
|
Loading…
Reference in New Issue