目前git上很大一部分缓存是写到一个缓存文件,意味着: 1.无论你是读取多大的数据,都需要从磁盘读出整个文件到内存,然后解析,获取你要的部分数据; 2.在缓存数据很大的时候,并不能起到缓存加速网站访问的目的,同时增加磁盘的读写负荷; 3.在某一个临界点
目前git上很大一部分缓存是写到一个缓存文件,意味着:
<?php
require_once('fcache.inc.php');
//example for https://github.com/hustcc/php-file-cache
$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');
?>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号