set data to storage or memory
(ctx context.Context, key string, raw []byte, exp time.Duration)
| 55 | |
| 56 | // set data to storage or memory |
| 57 | func (m *storageManager) setRaw(ctx context.Context, key string, raw []byte, exp time.Duration) error { |
| 58 | if m.storage != nil { |
| 59 | if err := m.storage.SetWithContext(ctx, key, raw, exp); err != nil { |
| 60 | return fmt.Errorf("csrf: failed to store key %q: %w", m.logKey(key), err) |
| 61 | } |
| 62 | return nil |
| 63 | } |
| 64 | |
| 65 | m.memory.Set(key, raw, exp) |
| 66 | return nil |
| 67 | } |
| 68 | |
| 69 | // delete data from storage or memory |
| 70 | func (m *storageManager) delRaw(ctx context.Context, key string) error { |