mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-11-26 06:37:07 +00:00
feat(cache): evict items idle past cache.idle_ttl
Every cached item got a 7-day expiry at store time. A popular tarball left the cache seven days after it was cached, however often clients requested it. Artifacts now get no age-based expiry. Cleanup removes any item whose last_accessed is older than cache.idle_ttl (default 168h, 0 disables). It reads the items in bounded batches of 500 through the indexed last_accessed column and deletes them through deletePackage. Metadata entries keep the freshness expiry from default_ttl. Startup and each cleanup run clear the expiry that earlier versions set on artifact rows. Cleanup records the idle and ttl eviction reasons and logs the count and bytes freed. The stats API reports idle_ttl in seconds. Package deletes are soft deletes and no history table has a foreign key to packages, so download history stays intact.
This commit is contained in:
@@ -15,6 +15,7 @@ require (
|
||||
github.com/gorilla/websocket v1.5.3
|
||||
github.com/lib/pq v1.12.3
|
||||
github.com/prometheus/client_golang v1.25.0
|
||||
github.com/prometheus/client_model v0.6.3
|
||||
github.com/rs/zerolog v1.35.1
|
||||
github.com/spf13/cobra v1.10.2
|
||||
github.com/spf13/viper v1.21.0
|
||||
@@ -110,7 +111,6 @@ require (
|
||||
github.com/pelletier/go-toml/v2 v2.4.3 // indirect
|
||||
github.com/philhofer/fwd v1.2.1 // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20260916203055-22a1a467d9f0 // indirect
|
||||
github.com/prometheus/client_model v0.6.3 // indirect
|
||||
github.com/prometheus/common v0.74.0 // indirect
|
||||
github.com/prometheus/procfs v0.23.0 // indirect
|
||||
github.com/sagikazarmark/locafero v0.12.0 // indirect
|
||||
|
||||
Reference in New Issue
Block a user