CodeIgniter的ci_sessions是否需要偶尔清空? [英] Does CodeIgniter's ci_sessions need occasional emptying?

查看:66
本文介绍了CodeIgniter的ci_sessions是否需要偶尔清空?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用CI的会话来连接数据库。因此我们所有的会话都在数据库的ci_sessions表中,并且考虑到session_id每隔5分钟就会更改一次,因此它可以获得很多行。

I am using CI's sessions in connection with a database. So all of our sessions are in this ci_sessions table on our database and it can get a lot of rows, considering that the session_id keep changing every 5 minutes.

我们需要吗清空表,比如说每月一次/每周一次?

Do we need to empty the table, say every one a month / week maybe?

推荐答案

不,CodeIgniter自身会清理干净...

No, CodeIgniter cleans up after itself...

注意

根据 CodeIgniter文档

Session类具有内置的垃圾收集器,该垃圾收集器可以清除过期的会话,因此您不需要编写自己的例程。

CodeIgniter的Session Class可能会检查会话表并清除过期的条目。但是,文档没有说明清理发生的时间。由于CodeIgniter中没有cron作业,因此在调用Session类时必须进行清理。我想如果该站点永远保持空闲状态,则会话表将永远不会被清除。但这是不寻常的情况。

CodeIgniter's Session Class probably checks the session table and cleans up expired entries. However, the documentation does not say when the clean up happens. Since there are no cron jobs as part of CodeIgniter, the clean up must occur when the Session class is invoked. I suppose if the site remains idle forever, the session table will never be cleared. But, this would be an unusual case.

这篇关于CodeIgniter的ci_sessions是否需要偶尔清空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆