一般使用文件方式的缓存就能够满足要求,而thinkPHP还提供了一个专门用于文件方式的快速缓存方法F方法,需要的朋友可以参考下
一般使用文件方式的缓存就能够满足要求,而thinkPHP还提供了一个专门用于文件方式的快速缓存方法F方法。
由于采用的是PHP返回方式,,所以其效率较S方法较高。
F方法具有如下特点:
1.简单数据缓存;
2.文件形式保存;
3.采用PHP返回数据方式加载缓存;
4.支持子目录缓存以及自动创建;
5.支持删除缓存和批量删除;
复制代码 代码如下:
$path="../Public/Runtime/";
$str="fastrunaaaaaaaaaaaaaaaa";
F("str/ffun",$str,$path);
这样就把$str字符串这个内容放在了../Public/Runtime/str/ffun.php的文件中了
ffun.php 的文件内容如下:
复制代码 代码如下:
return 'fastrunaaaaaaaaaaaaaaaa';
?>
删除缓存也很简单:
复制代码 代码如下:
F("str/ffun",NULL);

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

WebStorm Mac version
Useful JavaScript development tools
