Skip to content

Commit

Permalink
Improve wording of doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mgnsk committed Jan 9, 2025
1 parent f64b436 commit acb24d1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,40 +34,40 @@ func New[K comparable, V any](opt ...Option) *Cache[K, V] {
return c
}

// Len returns the number of initialized elements.
// Len returns the number of initialized values.
func (c *Cache[K, V]) Len() int {
return c.backend.Len()
}

// Has returns whether the element for key is initialized.
// Has returns whether the value for key is initialized.
func (c *Cache[K, V]) Has(key K) bool {
return c.backend.Has(key)
}

// Load an initialized element.
// Load an initialized value.
func (c *Cache[K, V]) Load(key K) (value V, loaded bool) {
return c.backend.Load(key)
}

// Range iterates over initialized cache elements in no particular order or consistency.
// Range iterates over initialized cache key-value pairs in no particular order or consistency.
// If f returns false, range stops the iteration.
//
// f may modify the cache.
func (c *Cache[K, V]) Range(f func(key K, value V) bool) {
c.backend.Range(f)
}

// Evict an element.
// Evict a value.
func (c *Cache[K, V]) Evict(key K) (value V, evicted bool) {
return c.backend.Evict(key)
}

// Store an element with the default TTL.
// Store a value with the default TTL.
func (c *Cache[K, V]) Store(key K, value V) {
c.backend.Store(key, value)
}

// StoreTTL stores an element with specified TTL.
// StoreTTL stores a value with specified TTL.
func (c *Cache[K, V]) StoreTTL(key K, value V, ttl time.Duration) {
c.backend.StoreTTL(key, value, ttl)
}
Expand Down

0 comments on commit acb24d1

Please sign in to comment.