MCPcopy
hub / github.com/appleboy/gin-jwt / Cleanup

Method Cleanup

store/memory.go:91–106  ·  view source on GitHub ↗

Cleanup removes expired tokens and returns the number of tokens cleaned up

(ctx context.Context)

Source from the content-addressed store, hash-verified

89
90// Cleanup removes expired tokens and returns the number of tokens cleaned up
91func (s *InMemoryRefreshTokenStore) Cleanup(ctx context.Context) (int, error) {
92 s.mu.Lock()
93 defer s.mu.Unlock()
94
95 var cleaned int
96 now := time.Now()
97
98 for token, data := range s.tokens {
99 if now.After(data.Expiry) {
100 delete(s.tokens, token)
101 cleaned++
102 }
103 }
104
105 return cleaned, nil
106}
107
108// Count returns the total number of active refresh tokens
109func (s *InMemoryRefreshTokenStore) Count(ctx context.Context) (int, error) {

Callers 1

Calls

no outgoing calls

Tested by 1