Note about thread safety. The Store implementation (cache.cache) uses a lock for all methods. In the functions below, the lock gets released and reacquired betweend the {Add,Delete,etc} and the List. So, the following can happen, resulting in two identical calls to PushFunc. time thread
(obj interface{})
| 43 | // 5 Store.List() -> [a,b] |
| 44 | |
| 45 | func (u *UndeltaStore) Add(obj interface{}) error { |
| 46 | if err := u.Store.Add(obj); err != nil { |
| 47 | return err |
| 48 | } |
| 49 | u.PushFunc(u.Store.List()) |
| 50 | return nil |
| 51 | } |
| 52 | |
| 53 | func (u *UndeltaStore) Update(obj interface{}) error { |
| 54 | if err := u.Store.Update(obj); err != nil { |