4 ms·
I believe the idiomatic way would be to have 2 "Add" functions: func (c *Cache) AddExpiring(k Key, e Entry, d time.Duration) {} func (c *Cache) Add(k Key,
by rakoo 11y ago
I believe the idiomatic way would be to have 2 "Add" functions:
func (c *Cache) AddExpiring(k Key, e Entry, d time.Duration) {}
func (c *Cache) Add(k Key, e Entry) {}
func (c *Cache) GetWithRemaining(k Key) (e Entry, left time.Duration) {}
Not the prettiest, but it does the job. That sentence could be Go's motto.