fully convert redis over to custom key value store type
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@ package store
|
||||
|
||||
// A simple key value store that can either just be single instance in memory or a redis server (for now)
|
||||
|
||||
type Store[Value any] interface {
|
||||
type KeyValueStore[Value any] interface {
|
||||
Create(key string, value Value) error
|
||||
Get(key string) (Value, error)
|
||||
Update(key string, session Value) error
|
||||
|
||||
@@ -42,6 +42,7 @@ func NewRedisStore[Value any]() *RedisStore[Value] {
|
||||
store := &RedisStore[Value]{
|
||||
client: rdb,
|
||||
ctx: ctx,
|
||||
prefix: "random_string_1",
|
||||
}
|
||||
return store
|
||||
}
|
||||
@@ -77,7 +78,7 @@ func (m *RedisStore[Value]) Get(sessionID string) (Value, error) {
|
||||
return session_data, ErrKeyBackend
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(data, session_data); err != nil {
|
||||
if err := json.Unmarshal(data, &session_data); err != nil {
|
||||
logging.Error(err.Error())
|
||||
return session_data, ErrKeyBackend
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user