Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
refactor: use the built-in max/min to simplify the code (#4781)
jinjingroad03399a60079d
diff --git a/store/cache/cache.go b/store/cache/cache.goindex d1d68bded..06e9a3d92 100644--- a/store/cache/cache.go+++ b/store/cache/cache.go@@ -251,10 +251,8 @@ func (c *Cache) cleanup() {// cleanupOldest removes the oldest items if we're over the max items.func (c *Cache) cleanupOldest() {- threshold := c.config.MaxItems / 5 // Remove 20% of max items at once- if threshold < 1 {- threshold = 1- }+ // Remove 20% of max items at once+ threshold := max(c.config.MaxItems/5, 1)currentCount := atomic.LoadInt64(&c.itemCount)