Skip to content

Commit

Permalink
export cache value
Browse files Browse the repository at this point in the history
  • Loading branch information
danclive committed Sep 6, 2023
1 parent c7f9c6a commit bc95696
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Value[T any] struct {
Updated time.Time
}

func newValue[T any](data T, ttl time.Duration) Value[T] {
func NewValue[T any](data T, ttl time.Duration) Value[T] {
return Value[T]{
Data: data,
TTL: ttl,
Expand Down Expand Up @@ -89,7 +89,7 @@ func (c *Cache[T]) Set(key string, value T, ttl time.Duration) {
c.lock.Lock()
defer c.lock.Unlock()

c.data[key] = newValue(value, ttl)
c.data[key] = NewValue(value, ttl)
}

func (c *Cache[T]) AutoSet(key string, fn func(key string) (T, time.Duration, error), duration time.Duration) chan<- struct{} {
Expand Down

0 comments on commit bc95696

Please sign in to comment.