| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package dscache | 5 package dscache |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "time" | 8 "time" |
| 9 | 9 |
| 10 ds "github.com/luci/gae/service/datastore" | 10 ds "github.com/luci/gae/service/datastore" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 80 } |
| 81 } else { | 81 } else { |
| 82 p.lme.Assign(i, err) | 82 p.lme.Assign(i, err) |
| 83 if err != ds.ErrNoSuchEntity { | 83 if err != ds.ErrNoSuchEntity { |
| 84 return // aka continue to the next entry | 84 return // aka continue to the next entry |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 if toSave != nil { | 88 if toSave != nil { |
| 89 if shouldSave { // save | 89 if shouldSave { // save |
| 90 » » » » » expSecs := metas.GetMetaDefault(i, Cache
ExpirationMeta, CacheTimeSeconds).(int64) | 90 » » » » » mg := metas.GetSingle(i) |
| 91 » » » » » expSecs := ds.GetMetaDefault(mg, CacheEx
pirationMeta, CacheTimeSeconds).(int64) |
| 91 toSave.SetFlags(uint32(ItemHasData)) | 92 toSave.SetFlags(uint32(ItemHasData)) |
| 92 toSave.SetExpiration(time.Duration(expSe
cs) * time.Second) | 93 toSave.SetExpiration(time.Duration(expSe
cs) * time.Second) |
| 93 toSave.SetValue(data) | 94 toSave.SetValue(data) |
| 94 } else { | 95 } else { |
| 95 // Set a lock with an infinite timeout.
No one else should try to | 96 // Set a lock with an infinite timeout.
No one else should try to |
| 96 // serialize this item to memcache until
something Put/Delete's it. | 97 // serialize this item to memcache until
something Put/Delete's it. |
| 97 toSave.SetFlags(uint32(ItemHasLock)) | 98 toSave.SetFlags(uint32(ItemHasLock)) |
| 98 toSave.SetExpiration(0) | 99 toSave.SetExpiration(0) |
| 99 toSave.SetValue(nil) | 100 toSave.SetValue(nil) |
| 100 } | 101 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 130 if err == nil { | 131 if err == nil { |
| 131 err = txnState.apply(d.supportContext) | 132 err = txnState.apply(d.supportContext) |
| 132 } | 133 } |
| 133 return err | 134 return err |
| 134 }, opts) | 135 }, opts) |
| 135 if err == nil { | 136 if err == nil { |
| 136 txnState.release(d.supportContext) | 137 txnState.release(d.supportContext) |
| 137 } | 138 } |
| 138 return err | 139 return err |
| 139 } | 140 } |
| OLD | NEW |