搜索
系统检测到您的用户名不符合规范:

关于tp5.1缓存的问题

浏览:4415 发布日期:2018年05月11日 分类:ThinkPHP5专区
有个用户数据通过cache 文件方式缓存,有多个接口会同时调用。发现偶尔(好几天)会出现如下错误的其中一个,后设置缓存时间为1秒,该错误机率就大幅增加。看这错误,难道是在程序执行时,恰好在缓存文件写入或删除时造成的没有权限或文件不存在?不知有啥方法可以避免?
其中一种错误提示:exception 'think\exception\ErrorException' with message 'unlink(E:\web\demo.thinkphp\zj\runtime\cache8円a62円f0beaa5ae938956f5ea290321336.php): No such file or directory' in E:\web\demo.thinkphp\zj\thinkphp\library\think\cache\driver\File.php:302 Stack trace: #0 [internal function]: think\Error::appError(2, 'unlink(E:\\web\\d...', 'E:\\web\\demo.thi...', 302, Array) #1 E:\web\demo.thinkphp\zj\thinkphp\library\think\cache\driver\File.php(302): unlink('E:\\web\\demo.thi...') #2 E:\w...hp\zj\thinkphp\library\think\Middleware.php(119): call_user_func_array(Object(Closure), Array) #23 [internal function]: think\Middleware->think\{closure}(Object(think\Request)) #24 E:\web\demo.thinkphp\zj\thinkphp\library\think\Middleware.php(74): call_user_func(Object(Closure), Object(think\Request)) #25 E:\web\demo.thinkphp\zj\thinkphp\library\think\App.php(399): think\Middleware->dispatch(Object(think\Request)) #26 E:\web\demo.thinkphp\zj\public\index.php(22): think\App->run() #27 {main}另一种错误:exception 'think\exception\ErrorException' with message 'file_get_contents(E:\web\demo.thinkphp\zj\runtime\cache8円a62円f0beaa5ae938956f5ea290321336.php): failed to open stream: Permission denied' in E:\web\demo.thinkphp\zj\thinkphp\library\think\cache\driver\File.php:133 Stack trace: #0 [internal function]: think\Error::appError(2, 'file_get_conten...', 'E:\\web\\demo.thi...', 133, Array) #1 E:\web\demo.thinkphp\zj\thinkphp\library\think\cache\driver\File.php(133): file_get_contents('E:\\web\\demo.thi...') #2 [internal function]: think\cache\driver\File->get('user16') #3 E:\web\demo.thinkphp\zj\thinkphp\library\think\Cache.php(114): call_user_func_array(Array, Array) #4 [internal function]: think\Cache->__call('get', Array) #5 [internal function]: think\Cache->get('user16') #6 E:\web\demo.thinkphp\zj\thinkphp\library\think\Facade.php(124): call_user_func_array(Array, Array) #7 E:\web\demo.thinkphp\zj\thinkphp\helper.php(129): think\Facade::__callStatic('get', Array) #8 E:\web\demo.thinkphp\zj\thinkphp\helper.php(129): think\facade\Cache::get('user16') #9 E:\web\demo.thinkphp\zj\application\oa\controller\Common.php(62): cache('user16') #10 E:\web\demo.thinkphp\zj\application\oa\controller\Common.php(29): app\oa\controller\Common->checkToken() #11 E:\web\demo.thinkphp\zj\thinkphp\library\think\Controller.php(70): app\oa\controller\Common->initialize() #12 [internal function]: think\Controller->__construct() #13 E:\web\demo.thinkphp\zj\thinkphp\library\think\Container.php(334): ReflectionClass->newInstanceArgs(Array) #14 E:\web\demo.thinkphp\zj\thinkphp\library\think\Container.php(202): think\Container->invokeClass('app\\oa\\controll...', Array) #15 E:\web\demo.thinkphp\zj\thinkphp\library\think\App.php(884): think\Container->make('app\\oa\\controll...') #16 E:\web\demo.thinkphp\zj\thinkphp\library\think\App.php(611): think\App->__get('app\\oa\\controll...') #17 E:\web\demo.thinkphp\zj\thinkphp\library\think\route\dispatch\Module.php(114): think\App->controller('user', 'controller', false, 'Error') #18 E:\web\demo.thinkphp\zj\thinkphp\library\think\route\dispatch\Url.php(31): think\route\dispatch\Module->run() #19 E:\web\demo.thinkphp\zj\thinkphp\library\think\App.php(378): think\route\dispatch\Url->run() #20 [internal function]: think\App->think\{closure}(Object(think\Request), Object(Closure), NULL) #21 E:\web\demo.thinkphp\zj\thinkphp\library\think\Middleware.php(119): call_user_func_array(Object(Closure), Array) #22 [internal function]: think\Middleware->think\{closure}(Object(think\Request)) #23 E:\web\demo.thinkphp\zj\thinkphp\library\think\Middleware.php(74): call_user_func(Object(Closure), Object(think\Request)) #24 E:\web\demo.thinkphp\zj\thinkphp\library\think\App.php(399): think\Middleware->dispatch(Object(think\Request)) #25 E:\web\demo.thinkphp\zj\public\index.php(22): think\App->run() #26 {main}
URL:http://demo.thinkphp.zj/oa/user/read
最佳答案
评论() 相关
后面还有条评论,
评论支持使用[code][/code]标签添加代码
您需要登录后才可以评论 登录 | 立即注册
收藏
姜半夏HZ
积分:1705 等级:LV3
热点推荐
(追記) (追記ここまで)
最新更新

我们

合作

网站

信息

ThinkPHP 是一个免费开源的,快速、简单的面向对象的 轻量级PHP开发框架 ,创立于2006年初,遵循Apache2开源协议发布,是为了敏捷WEB应用开发和简化企业应用开发而诞生的。ThinkPHP从诞生以来一直秉承简洁实用的设计原则,在保持出色的性能和至简的代码的同时,也注重易用性。并且拥有众多的原创功能和特性,在社区团队的积极参与下,在易用性、扩展性和性能方面不断优化和改进,已经成长为国内最领先和最具影响力的WEB应用开发框架,众多的典型案例确保可以稳定用于商业以及门户级的开发。

AltStyle によって変換されたページ (->オリジナル) /