RLockFuncWithKey executes a function with read lock on the shard containing the key. WARNING: Do not perform write operations on the container within f to avoid deadlocks.
(key string, f func(shardData map[string]interface{}))
| 253 | // RLockFuncWithKey executes a function with read lock on the shard containing the key. |
| 254 | // WARNING: Do not perform write operations on the container within f to avoid deadlocks. |
| 255 | func (slm ShardLockMaps) RLockFuncWithKey(key string, f func(shardData map[string]interface{})) { |
| 256 | shard := slm.GetShard(key) |
| 257 | shard.RLock() |
| 258 | defer shard.RUnlock() |
| 259 | f(shard.items) |
| 260 | } |
| 261 | |
| 262 | // LockFunc executes a function with write lock on all shards. |
| 263 | // WARNING: Do not perform operations on the container within f to avoid deadlocks. |