How to handle hybrid storage from external libraries #81
-
Hello, I really appreciate your article and have been trying to implement the approach as it makes a lot of sense. I also watched the Brian Ketelsen talk that referred to it as well. Where I am struggling right now is when a library uses a hybrid approach to storage. For example, I am using the https://github.com/alexedwards/scs library for session with redis as a backend storage. So this is using a combination of http cookies and redis for tracking the session. I create a session interface in my domain type package
But where do I handle the implementation for this? Do I handle it in the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
If you're only managing sessions in the If you are managing sessions outside the |
Beta Was this translation helpful? Give feedback.
If you're only managing sessions in the
http
layer then I think you can avoid a service interface definition entirely and just use thescs
library internally in thehttp
package.If you are managing sessions outside the
http
layer, then it doesn't matter too much about which package you place it into so long as its accessible. The main benefit to having theSessionService
interface would be to have swappable implementations but that's not typical fo…