Google Cloud Datastore Sessions
Note: Cloud Datastore is a persistent, distributed, transactional database. Often, it's more appropriate to choose a different storage solution for sessions such as Memcache or Redis as their designs offer much faster operation in this use case.
npm install @google-cloud/connect-datastore
You must have a Google Cloud project and credentials.
See gcloud node's documentation on setting up authentication.
const Datastore = ;const DatastoreStore = ;const express = ;const session = ;const app = ;app;
If a session is fetched with the delta between the createdAt time and current time greater than expirationMs, the session will not be returned and will instead be destroyed.
Datastore does not support a
ttl, and tokens are only deleted if a session
is fetched. You will likely want to implement logic to occasionally delete
- See CONTRIBUTING.md
- Apache 2.0 - See LICENSE