EnableRedisStore enables Redis store with optional configuration
(opts ...RedisOption)
| 59 | |
| 60 | // EnableRedisStore enables Redis store with optional configuration |
| 61 | func (mw *GinJWTMiddleware) EnableRedisStore(opts ...RedisOption) *GinJWTMiddleware { |
| 62 | mw.UseRedisStore = true |
| 63 | |
| 64 | // Start with default config |
| 65 | config := store.DefaultRedisConfig() |
| 66 | |
| 67 | // Apply all options |
| 68 | for _, opt := range opts { |
| 69 | opt(config) |
| 70 | } |
| 71 | |
| 72 | mw.RedisConfig = config |
| 73 | return mw |
| 74 | } |
| 75 | |
| 76 | // initializeRedisStore attempts to create and initialize Redis store |
| 77 | // Falls back to in-memory store if Redis connection fails |