@@ -3,7 +3,6 @@ package session
3
3
import (
4
4
"context"
5
5
"fmt"
6
- "time"
7
6
)
8
7
9
8
/* TODO: make the operations below thread safe with mutexes*/
@@ -26,47 +25,6 @@ func (m *Manager) saveSessionRedis(session *Session) error {
26
25
return nil
27
26
}
28
27
29
- /* update expiry time in session */
30
- func (m * Manager ) updateSessionExpiryRedis (session * Session ) error {
31
-
32
- /*
33
- function expects that new expiry time is already set in the session
34
- */
35
-
36
- ctx := context .Background ()
37
-
38
- /* create a key for Redis operation */
39
- key := fmt .Sprintf ("session:%s" , session .ID )
40
-
41
- /* convert the expiry time to */
42
- formattedExpiry := session .Expiry .Format (time .RFC3339 )
43
-
44
- /* update just the expiry field */
45
- err := m .redis .HSet (ctx , key , "expiry" , formattedExpiry ).Err ()
46
- if err != nil {
47
- return fmt .Errorf ("failed to update session expiry in Redis: %w" , err )
48
- }
49
-
50
- return nil
51
- }
52
-
53
- /* update status of the session - update and set expired operations will be done with this */
54
- func (m * Manager ) updateSessionStatusRedis (session * Session , status Status ) error {
55
-
56
- ctx := context .Background ()
57
-
58
- /* create a key for Redis operation */
59
- key := fmt .Sprintf ("session:%s" , session .ID )
60
-
61
- /* update the session status */
62
- err := m .redis .HSet (ctx , key , "status" , status ).Err ()
63
- if err != nil {
64
- return fmt .Errorf ("failed to mark session as expired in Redis: %w" , err )
65
- }
66
-
67
- return nil
68
- }
69
-
70
28
/* increment the failed field of the session in Redis */
71
29
func (m * Manager ) IncrementSessionFailedRedis (session * Session ) error {
72
30
ctx := context .Background ()
0 commit comments