Skip to content

Conversation

@otchilin
Copy link

Hi,

As Redis is now supporting JSON, it will be great to also store the session data directly in this format.
This will allows for example to create indexes and find sessions easily against some details as user id or whatever you want. And this is much more optimized than SCAN/MGET over a prefix.

So I propose a small enhancement to add this option (useRedisJson) which is disabled by default to keep standard behavior if not configured.

I've also reworked the build workflow to run test over redis-stack-server under Ubuntu 20.04 which support it via the redis repo.

Hope it will help...

Regards,

@wavded
Copy link
Collaborator

wavded commented Feb 27, 2025

Hey @otchilin, thanks for working on this and bringing to my attention. Do you have resources that explains the benefits of this approach? Maintaining this project now for multiple years and being a user for many before that, I haven't seen any real issues with the storage mechanism in place. I get it is a neat feature that does have benefits but not seeing its benefits for this project yet. Is this widely available? Why did you have to switch to redis-stack-server to test it?

@otchilin
Copy link
Author

Hi @wavded,
Thanks for answer. There is no problem with current storage 👍
Personally, I thought about it when I said to myself that it would be good to have a mechanism in my implementation to kill all the sessions of a given user, for security reason for example...

And since I don't have a reference to the sessions, I would have to search in all the existing sessions those where I find the corresponding user id.
This search through Redis is not very optimized especially if there are a lot of entries.
On the other hand, with the Redis plugin it is possible to have an index and therefore to be much more efficient.

And then, it seems natural to store JSON objects in a storage that supports this format 😉

Concerning the test, I've introduced redis stack server because it supports the json plugin and it's necessary to test the new behavior.

So nothing revolutionary but a little plus for those who would like to take advantage of the power of the Redis JSON plugin.
Of course I understand that it complicates the processing and that it could harm the robustness.

@wavded
Copy link
Collaborator

wavded commented Feb 28, 2025

Thanks for the explanation. We do have the all and ids methods that are used currently if you wanted to search through all the sessions for something. Not as fast as a direct JSON query but are usually used in debugging scenarios anyway.

My gut is to keep this PR around and the concept out there as a possibility and see if the need grows/more use cases come out.

@Xalior
Copy link

Xalior commented Mar 18, 2025

+1 for the ability to search and destroy sessions based on some query / around session KV pairs.

@github-actions
Copy link

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Apr 18, 2025
@github-actions github-actions bot closed this Apr 23, 2025
@wavded wavded reopened this Apr 23, 2025
@wavded wavded removed the stale label Apr 23, 2025
@github-actions
Copy link

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label May 24, 2025
@wavded wavded removed the stale label May 24, 2025
@github-actions
Copy link

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Jun 24, 2025
@github-actions github-actions bot closed this Jun 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants