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 » » » » » v, err := ds.GetMetaDefault(mg, CacheExp irationMeta, CacheTimeSeconds) | |
92 » » » » » if err != nil { | |
93 » » » » » » // TODO(riannucci): Not sure wha t to do with this. | |
iannucci
2015/12/12 03:52:22
as in; this should basically never happen, but if
| |
94 » » » » » » panic(err) | |
95 » » » » » } | |
96 » » » » » expSecs := v.(int64) | |
91 toSave.SetFlags(uint32(ItemHasData)) | 97 toSave.SetFlags(uint32(ItemHasData)) |
92 toSave.SetExpiration(time.Duration(expSe cs) * time.Second) | 98 toSave.SetExpiration(time.Duration(expSe cs) * time.Second) |
93 toSave.SetValue(data) | 99 toSave.SetValue(data) |
94 } else { | 100 } else { |
95 // Set a lock with an infinite timeout. No one else should try to | 101 // 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. | 102 // serialize this item to memcache until something Put/Delete's it. |
97 toSave.SetFlags(uint32(ItemHasLock)) | 103 toSave.SetFlags(uint32(ItemHasLock)) |
98 toSave.SetExpiration(0) | 104 toSave.SetExpiration(0) |
99 toSave.SetValue(nil) | 105 toSave.SetValue(nil) |
100 } | 106 } |
(...skipping 29 matching lines...) Expand all Loading... | |
130 if err == nil { | 136 if err == nil { |
131 err = txnState.apply(d.supportContext) | 137 err = txnState.apply(d.supportContext) |
132 } | 138 } |
133 return err | 139 return err |
134 }, opts) | 140 }, opts) |
135 if err == nil { | 141 if err == nil { |
136 txnState.release(d.supportContext) | 142 txnState.release(d.supportContext) |
137 } | 143 } |
138 return err | 144 return err |
139 } | 145 } |
OLD | NEW |