简体   繁体   English

是否有可能实现与arangodb的PHP会话处理程序

[英]is it possible implement php session handler with arangodb

I 'v posted my question some days ago in the official arangodb website , but no lucks no people answer it . 我几天前在官方的arangodb网站上发布了我的问题,但没有运气没有人回答。 so i come to here . 所以我来到这里 below is my question: 以下是我的问题:

just want to know if use arangoDb as a php sessionHandler , how can i delete the session data that expired ! 只是想知道如果使用arangoDb作为php sessionHandler,我怎样才能删除过期的会话数据!

if use the mogodb or mysql to store the session data, we can use such statement to remove the expired data: db.session.remove( { expire: { $gt :} } ) or the sql : delete from tbl_session where expire<:expire 如果使用mogodb或mysql来存储会话数据,我们可以使用这样的语句来删除过期的数据:db.session.remove({expire:{$ gt:}})或sql:delete from tbl_session where expire <:到期

I just want to know how this can be implemented in arangodb . 我只是想知道如何在arangodb中实现这一点。 :) :)

We do not yet support modifying AQLs. 我们还不支持修改AQL。 So you need to execute a bit of code: 所以你需要执行一些代码:

var q = db._query("FOR s in session filter s.expire < 1393231738788 return s");
while (q.hasNext()) {
  db.session.remove(q.next());
}

mchacki's answer is correct till ArangoDB 2.2. mchacki的答案是正确的,直到ArangoDB 2.2。

Since 2.2 we do have modified queries so the new query for our Database would look like this: 从2.2开始我们确实有修改过的查询,所以我们数据库的新查询看起来像这样:

FOR s IN sessions
  FILTER s.expire < DATE_NOW()-86400000
  REMOVE s IN sessions

With this example one day old sessions would be deleted. 通过此示例,将删除一天的会话。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM