Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add session-store to express #120

Merged
merged 7 commits into from
Jun 11, 2021
Merged

Conversation

mohit038-zz
Copy link
Contributor

#104

This PR adds Redis as a session store for express.

Copy link
Member

@tobiasdiez tobiasdiez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good to me, only one small question.

app.use(
session({
store: new RedisStore({
client: this.redisClient,
disableTouch: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you disabled touch, i.e that session are kept alive when the user interacts with the service without changing the session in itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Redis, we can store data with a timer, and then later, whenever we interact with that data, Touch will update the timer. Here we aren't setting any timer. We want to store sessions forever. So no need to keep updating it.
It reduces the number of requests to Redis.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I understood the documentation

ttl
If the session cookie has a expires date, connect-redis will use it as the TTL.
Otherwise, it will expire the session using the ttl option (default: 86400 seconds or one day).

that it normally expires after 1day. If disableTouch: false then actions reset the ttl, so that session expire 1 day after the last interaction; otherwise 1 day after creation of the session. Anyway, since maxAge is set rather high, this shouldn't be much of a problem and can easily be changed later.

Copy link
Member

@tobiasdiez tobiasdiez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I currently cannot activate redis on heruko (temporary problem with the payment method), I will keep this PR open for now and merge later.

@tobiasdiez
Copy link
Member

Redis should work now on Azure...so let's merge 🚀

@tobiasdiez tobiasdiez merged commit 15780cf into JabRef:main Jun 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants