public static function updateSystemCache() { $setting_file = WEB_ROOT_DIR . self::$cache_file; // FFile::rmDir(WEB_ROOT_DIR . 'data/system/'); $t = new FTable('setting'); $settings = $t->select(); $setting_write = array(); foreach ($settings as $row) { $setting_write[$row['setting_key']] = $row['setting_value']; } FFile::save($setting_file, "<?php\n" . 'return ' . var_export($setting_write, true) . ';'); FCache::flush(); }
<?php require_once 'fcache.inc.php'; //example $cache = new FCache(); $storeData = array('time' => time(), 'str' => 'test', 'int' => 1321); $cache->add('select * from table;', $storeData); $cache->add('select * from table;', $storeData); $cache->add('select * from table;', $storeData); $cache->add('select * from table;', $storeData); print_r($storeData = $cache->get('select * from table;')); $cache->delete('select * from table;'); print_r($cache->get('select * from table;') ? 'exist' : 'has no cache'); $cache->add('select * from table1;', 123); $cache->add('select * from table2;', 234); $cache->add('select * from table3;', 345); $cache->flush(); print_r($cache->get('select * from table3;') ? 'exist' : 'has no cache');