坑,Laravel的cache系统与entrust与throttle

坑,Laravel的cache系统与entrust与throttle

laravel默认是使用file做cache驱动的,但file与database驱动的cache无法支持tag,这就与我用到的entrust插件冲突了,所以改成了array作为cache系统的驱动。

后来想用throttle中间件的时候,发现throttle无效,一猜就是cache的问题,因为改用array做cache后,array其实相当于一次进程获得的内存空间开辟的一块数组,那么如果cache在这个数组里面,请求处理完后,这个数组已经没有啦!所以throttle根本不起作用。想了想最好的办法还是得换redis或者memcache做cache驱动,尤其在生产环境。

 

Leave a Reply

Your email address will not be published. Required fields are marked *