如何构建一个高效处理长尾关键词的文件缓存系统?
- 内容介绍
- 相关推荐
本文共计237个文字,预计阅读时间需要1分钟。
pythonclass SimpleFileCache: def __init__(self, basePth='./'): self.basePth=basePth
@desc 设置缓存 @param key @param con @return bool|int
def setCache(self, key, con): path=self.getPath(key) return file_put_contents(path, con)
一个简单的文件缓存类basePth = './'.$basePth; } /** * @desc 设置缓存 * @param $key * @param $con * @return bool|int */ public function setCache($key,$con){ $path = $this->getPath($key); return file_put_contents($path,$con); } /** * @desc 参数 time 表示cache的存活期,单位 秒,默认无限期 * @param $key * @param int $time * @return bool|string */ public function getCache($key,$time=0){ $path = $this->getPath($key); if(!is_file($path))return false; if($time&&filemtime($path)+$time
本文共计237个文字,预计阅读时间需要1分钟。
pythonclass SimpleFileCache: def __init__(self, basePth='./'): self.basePth=basePth
@desc 设置缓存 @param key @param con @return bool|int
def setCache(self, key, con): path=self.getPath(key) return file_put_contents(path, con)
一个简单的文件缓存类basePth = './'.$basePth; } /** * @desc 设置缓存 * @param $key * @param $con * @return bool|int */ public function setCache($key,$con){ $path = $this->getPath($key); return file_put_contents($path,$con); } /** * @desc 参数 time 表示cache的存活期,单位 秒,默认无限期 * @param $key * @param int $time * @return bool|string */ public function getCache($key,$time=0){ $path = $this->getPath($key); if(!is_file($path))return false; if($time&&filemtime($path)+$time

