【Laravel3.0.0源码阅读分析】APC缓存类apc.php
发布日期:2021-06-30 20:44:47 浏览次数:2 分类:技术文章

本文共 1043 字,大约阅读时间需要 3 分钟。

key = $key; } /** * Determine if an item exists in the cache. * 确定缓存中是否存在指定键的项 * @param string $key * @return bool */ public function has($key) { return ( ! is_null($this->get($key))); } /** * Retrieve an item from the cache driver. * 从缓存驱动程序中检索项 * @param string $key * @return mixed */ protected function retrieve($key) { // apc_fetch 从缓存中获取存储的变量 if (($cache = apc_fetch($this->key.$key)) !== false) { return $cache; } } /** * Write an item to the cache for a given number of minutes. * 向缓存中写入一个带有过期时间的项 * * // Put an item in the cache for 15 minutes * Cache::put('name', 'Taylor', 15); * * * @param string $key * @param mixed $value * @param int $minutes * @return void */ public function put($key, $value, $minutes) { // apc_store-在数据存储中缓存一个变量 apc_store($this->key.$key, $value, $minutes * 60); } /** * Delete an item from the cache. * 从缓存中删除一个项 * @param string $key * @return void */ public function forget($key) { // apc_delete 从缓存中删除存储的变量 apc_delete($this->key.$key); }}

 

转载地址:https://liushilong.blog.csdn.net/article/details/117429085 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:【Laravel3.0.0源码阅读分析】数据库缓存类database.php
下一篇:【Laravel3.0.0源码阅读分析】请求类request.php

发表评论

最新留言

感谢大佬
[***.8.128.20]2024年04月24日 19时49分45秒