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

Function BenchmarkInMemoryRefreshTokenStore_Get

store/memory_test.go:423–439  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

421}
422
423func BenchmarkInMemoryRefreshTokenStore_Get(b *testing.B) {
424 store := NewInMemoryRefreshTokenStore()
425 user := &User{ID: "123", Username: "testuser"}
426 expiry := time.Now().Add(time.Hour)
427
428 // Pre-populate with tokens
429 for i := 0; i < 1000; i++ {
430 token := fmt.Sprintf("token%d", i)
431 _ = store.Set(context.Background(), token, user, expiry)
432 }
433
434 b.ResetTimer()
435 for i := 0; i < b.N; i++ {
436 token := fmt.Sprintf("token%d", i%1000)
437 _, _ = store.Get(context.Background(), token)
438 }
439}
440
441func BenchmarkInMemoryRefreshTokenStore_Delete(b *testing.B) {
442 store := NewInMemoryRefreshTokenStore()

Callers

nothing calls this directly

Calls 3

SetMethod · 0.95
GetMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…