MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / AddSync

Method AddSync

internal/caches/list_file_db_sqlite.go:203–216  ·  view source on GitHub ↗
(hash string, item *Item)

Source from the content-addressed store, hash-verified

201}
202
203func (this *SQLiteFileListDB) AddSync(hash string, item *Item) error {
204 this.hashMap.Add(hash)
205
206 if item.StaleAt == 0 {
207 item.StaleAt = item.ExpiresAt
208 }
209
210 _, err := this.insertStmt.Exec(hash, item.Key, item.HeaderSize, item.BodySize, item.MetaSize, item.ExpiresAt, item.StaleAt, item.Host, item.ServerId, fasttime.Now().Unix())
211 if err != nil {
212 return this.WrapError(err)
213 }
214
215 return nil
216}
217
218func (this *SQLiteFileListDB) DeleteSync(hash string) error {
219 this.hashMap.Delete(hash)

Callers 1

AddMethod · 0.80

Calls 5

WrapErrorMethod · 0.95
NowFunction · 0.92
UnixMethod · 0.80
AddMethod · 0.65
ExecMethod · 0.45

Tested by

no test coverage detected