Would people be interested in a session storage im...
# ktor
m
Would people be interested in a session storage implementation backed by redis? I needed it for a project, but I don't mind open sourcing it. (Unlike the example in https://ktor.io/features/sessions.html, it has tests, and is non-blocking.)
o
I think @Deactivated User just implemented one yesterday… Please talk and review each other’s code and find the best possible solution to merge 🙂
d
https://github.com/ktorio/ktor/compare/redis-cio still requires review, but you can check it already. Let me know if you opensource your code to check if we can merge efforts :) and of course comments/suggestions are welcome!
m
Great, I’ll check it out!
The session part is pretty similar, but mine uses the lettuce.io redis client. I can imagine that once the redis client in that branch is done, it will be simpler to have something with fewer dependencies, but for now using a battle-tested redis client suits my needs better. Can't compete with a built-in solution... I'm happy to package up my stuff if people will find it useful today but probably by a month from now the built-in one will be ready I imagine
d
Sure. Makes sense. The redis protocol is pretty simple and the session only uses a small subset of redis. I have done some stress tests already and should behave well under pressure. But obviously the more time, the more tested. The idea of providing a custom CIO client is that it can work in the future with Kotlin Native too. Also I think may make sense to allow to select a redis implementation like happens with the server and the http client so people can choose. So if you opensource your client, maybe we can provide both the CIO and the lettuce.io clients 🙂
👍 1
m
Good point. it wouldn't need to be a very sophisticated abstraction layer -- just a couple of commands
I'll see if I can carve that out in the next couple of days
👏 1
One thing that would be great is to have a comprehensive test suite applicable to any session storage implementation. It feels silly to write a session storage test that has nothing to do with redis specifically
d
Makes sense
I have updated the redis proposal to allow several engines and have provided one engine using CIO and other using Lettuce. Probably a lot to improve still, so any feedback is welcome 🙂 : https://github.com/ktorio/ktor/compare/redis-cio
m
Great, thanks. Sorry for not following up sooner.