mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
Issue 1881: Support for Wincache
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10552 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
31196ee1ae
commit
45d6f79483
4 changed files with 78 additions and 4 deletions
3
classes/cache/CacheApc.class.php
vendored
3
classes/cache/CacheApc.class.php
vendored
|
|
@ -60,7 +60,8 @@ class CacheApc extends CacheBase {
|
|||
}
|
||||
|
||||
function delete($key) {
|
||||
$this->_delete($key);
|
||||
$_key = md5(_XE_PATH_.$key);
|
||||
$this->_delete($_key);
|
||||
}
|
||||
|
||||
function truncate() {
|
||||
|
|
|
|||
4
classes/cache/CacheHandler.class.php
vendored
4
classes/cache/CacheHandler.class.php
vendored
|
|
@ -25,13 +25,13 @@ class CacheHandler extends Handler {
|
|||
else if(substr($info->use_object_cache,0,8)=='memcache'){
|
||||
$type = 'memcache';
|
||||
$url = $info->use_object_cache;
|
||||
}
|
||||
} else if($info->use_object_cache == 'wincache') $type = 'wincache';
|
||||
}else if($target == 'template'){
|
||||
if($info->use_template_cache =='apc') $type = 'apc';
|
||||
else if(substr($info->use_template_cache,0,8)=='memcache'){
|
||||
$type = 'memcache';
|
||||
$url = $info->use_template_cache;
|
||||
}
|
||||
} else if($info->use_template_cache == 'wincache') $type = 'wincache';
|
||||
}
|
||||
|
||||
if($type){
|
||||
|
|
|
|||
73
classes/cache/CacheWincache.class.php
vendored
Normal file
73
classes/cache/CacheWincache.class.php
vendored
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
/**
|
||||
* @class CacheWincache
|
||||
* @author Arnia (support@xpressengine.org)
|
||||
* @brief Wincache Handler
|
||||
* @version 0.1
|
||||
**/
|
||||
|
||||
class CacheWincache extends CacheBase {
|
||||
var $valid_time = 36000;
|
||||
|
||||
function getInstance($opt=null){
|
||||
if(!$GLOBALS['__CacheWincache__']) {
|
||||
$GLOBALS['__CacheWincache__'] = new CacheWincache();
|
||||
}
|
||||
return $GLOBALS['__CacheWincache__'];
|
||||
}
|
||||
|
||||
function CacheWincache(){
|
||||
}
|
||||
|
||||
function isSupport(){
|
||||
return function_exists('wincache_ucache_set');
|
||||
}
|
||||
|
||||
function put($key, $buff, $valid_time = 0){
|
||||
if($valid_time == 0) $valid_time = $this->valid_time;
|
||||
return wincache_ucache_set(md5(_XE_PATH_.$key), array(time(), $buff), $valid_time);
|
||||
}
|
||||
|
||||
function isValid($key, $modified_time = 0) {
|
||||
$_key = md5(_XE_PATH_.$key);
|
||||
$obj = wincache_ucache_get($_key, $success);
|
||||
if(!$success || !is_array($obj)) return false;
|
||||
unset($obj[1]);
|
||||
|
||||
if($modified_time > 0 && $modified_time > $obj[0]) {
|
||||
$this->_delete($_key);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function get($key, $modified_time = 0) {
|
||||
$_key = md5(_XE_PATH_.$key);
|
||||
$obj = wincache_ucache_get($_key, $success);
|
||||
if(!$success || !is_array($obj)) return false;
|
||||
|
||||
if($modified_time > 0 && $modified_time > $obj[0]) {
|
||||
$this->_delete($_key);
|
||||
return false;
|
||||
}
|
||||
|
||||
return $obj[1];
|
||||
}
|
||||
|
||||
function _delete($_key) {
|
||||
wincache_ucache_delete($_key);
|
||||
}
|
||||
|
||||
function delete($key) {
|
||||
$_key = md5(_XE_PATH_.$key);
|
||||
$this->_delete($_key);
|
||||
}
|
||||
|
||||
function truncate() {
|
||||
return wincache_ucache_clear();
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file CacheWincache.class.php */
|
||||
/* Location: ./classes/cache/CacheWincache.class.php */
|
||||
|
|
@ -81,7 +81,7 @@ class FileHandler {
|
|||
$filesize = filesize($file_name);
|
||||
if($filesize<1) return;
|
||||
|
||||
if(function_exists('file_get_contents')) return file_get_contents($file_name);
|
||||
if(function_exists('file_get_contents')) return @file_get_contents($file_name);
|
||||
|
||||
$fp = fopen($file_name, "r");
|
||||
$buff = '';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue