CAS is a part of kv.Client interface.
(ctx context.Context, key string, f func(in any) (out any, retry bool, err error))
| 303 | |
| 304 | // CAS is a part of kv.Client interface. |
| 305 | func (m *MultiClient) CAS(ctx context.Context, key string, f func(in any) (out any, retry bool, err error)) error { |
| 306 | _, kv := m.getPrimaryClient() |
| 307 | |
| 308 | updatedValue := any(nil) |
| 309 | err := kv.client.CAS(ctx, key, func(in any) (any, bool, error) { |
| 310 | out, retry, err := f(in) |
| 311 | updatedValue = out |
| 312 | return out, retry, err |
| 313 | }) |
| 314 | |
| 315 | if err == nil && updatedValue != nil && m.mirroringEnabled.Load() { |
| 316 | m.writeToSecondary(ctx, kv, key, updatedValue) |
| 317 | } |
| 318 | |
| 319 | return err |
| 320 | } |
| 321 | |
| 322 | // WatchKey is a part of kv.Client interface. |
| 323 | func (m *MultiClient) WatchKey(ctx context.Context, key string, f func(any) bool) { |
nothing calls this directly
no test coverage detected