File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package repository
33import (
44 "context"
55 "encoding/json"
6+ "time"
67
78 "github.com/redis/rueidis"
89)
@@ -61,7 +62,9 @@ func (r *RedisSessionRepository) CreateSession(
6162 return out , err
6263 }
6364
64- cmd := r .c .B ().Set ().Key (params .UUID ).Value (string (raw )).Nx ().Build ()
65+ cmd := r .c .B ().Set ().Key (params .UUID ).Value (string (raw )).
66+ Nx ().ExSeconds (params .Expiry - time .Now ().Unix ()).
67+ Build ()
6568 if err := r .c .Do (ctx , cmd ).Error (); err != nil {
6669 return out , err
6770 }
@@ -94,7 +97,10 @@ func (r *RedisSessionRepository) UpdateSession(
9497 return session , err
9598 }
9699
97- cmd := r .c .B ().Set ().Key (params .UUID ).Value (string (raw )).Build ()
100+ cmd := r .c .B ().Set ().Key (params .UUID ).
101+ Value (string (raw )).
102+ ExSeconds (params .Expiry - time .Now ().Unix ()).
103+ Build ()
98104 if err := r .c .Do (ctx , cmd ).Error (); err != nil {
99105 return session , err
100106 }
You can’t perform that action at this time.
0 commit comments