diff options
| author | Shulhan <ms@kilabit.info> | 2026-01-22 01:39:41 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2026-01-22 01:39:41 +0700 |
| commit | 79eaccc81b85eb92dab9cf18d52662f367903652 (patch) | |
| tree | af58482138c2ba9211029174ab579e951cd7fff6 /cache.go | |
| parent | 26fc8bd3203dae6b4705ada227439c90129bbe36 (diff) | |
| download | jarink-79eaccc81b85eb92dab9cf18d52662f367903652.tar.xz | |
all: refactoring, use single struct to represent Link
Previously, have [jarink.Link], [brokenlinks.Broken], and
[brokenlinks.linkQueue] to store the metadata for a link.
These changes unified them into struct [jarink.Link].
Diffstat (limited to 'cache.go')
| -rw-r--r-- | cache.go | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -80,18 +80,13 @@ func (cache *Cache) Save() (err error) { return nil } -func (cache *Cache) Set(url string, respCode int, size int64) { +func (cache *Cache) Set(link Link) { cache.mtx.Lock() defer cache.mtx.Unlock() - var scannedLink = cache.ScannedLinks[url] + var scannedLink = cache.ScannedLinks[link.Url] if scannedLink != nil { return } - scannedLink = &Link{ - Url: url, - Size: size, - ResponseCode: respCode, - } - cache.ScannedLinks[url] = scannedLink + cache.ScannedLinks[link.Url] = &link } |
