replaceHashed add or replaces an entry to the cache based on its hash. If a parent is specified it will be added to that if not already there. If the parent does not exist, it will be added.
(hash dataUsageHash, parent *dataUsageHash, e dataUsageEntry)
| 533 | // If a parent is specified it will be added to that if not already there. |
| 534 | // If the parent does not exist, it will be added. |
| 535 | func (d *dataUsageCache) replaceHashed(hash dataUsageHash, parent *dataUsageHash, e dataUsageEntry) { |
| 536 | if d.Cache == nil { |
| 537 | d.Cache = make(map[string]dataUsageEntry, 100) |
| 538 | } |
| 539 | d.Cache[hash.Key()] = e |
| 540 | if parent != nil { |
| 541 | p := d.Cache[parent.Key()] |
| 542 | p.addChild(hash) |
| 543 | d.Cache[parent.Key()] = p |
| 544 | } |
| 545 | } |
| 546 | |
| 547 | // copyWithChildren will copy entry with hash from src if it exists along with any children. |
| 548 | // If a parent is specified it will be added to that if not already there. |
no test coverage detected