问题
Is it possible to query current active sessions with couchdb?
The server is able to keep track of sessions based on the timeout value so how would I figure out what users have an active session?
回答1:
CouchDB doesn't knows anything about active sessions. These "sessions" are actually based on HTTP Cookie, which holds username, timestamp and signature hash. When CouchDB handling the request, it decodes cookie's AuthSession value and verifies that:
- Username is correct and exists
- Timestamp + TTL isn't lesser than current time
- Signature is valid
If all these conditions are ok: request is accepted for further processing. If Timestamp is closer to expiration border, CouchDB updates the cookie to make the "session" last longer.
For this scheme there is no reason and need to maintain internal list of active sessions.
来源:https://stackoverflow.com/questions/22675393/how-to-determine-current-active-users-in-couchdb