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

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

key = $key; $this->memcache = $memcache; } /** * 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) { if (($cache = $this->memcache->get($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) { $this->memcache->set($this->key.$key, $value, 0, $minutes * 60); } /** * Delete an item from the cache. * 从缓存中删除一个项 * @param string $key * @return void */ public function forget($key) { $this->memcache->delete($this->key.$key); }}

github地址:    

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

上一篇:【Laravel3.0.0源码阅读分析】Redis缓存类redis.php
下一篇:【Laravel3.0.0源码阅读分析】文件缓存类file.php

发表评论

最新留言

路过,博主的博客真漂亮。。
[***.116.15.85]2024年04月05日 16时56分08秒