salmanahmad / dog

The Dog Programming Language
http://www.dog-lang.org
Apache License 2.0
0 stars 0 forks source link

Mongo-Backed Sessions #62

Open salmanahmad opened 11 years ago

salmanahmad commented 11 years ago

Whenever a client connects to the API we ensure an associated session_id. The session_id is stored in Mongo as a document with the follow schema:

{
  session_id: <oid>,
  user_id: <oid>,
  last_activity: <date>
}

The session_id is associated with any data that is passed into a Dog program and developers can access this id. They can also associate a real user with the session.

The sessions will eventually timeout after some amount of times. Perhaps, 1 hour? They could also be implemented as a TTL collection in Mongo.