From f5e094f2c431f5a03d899b0866692e3534c72066 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Fri, 11 Aug 2023 15:12:28 +0200 Subject: update to golang-lru v2 --- cache/subcache.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cache/subcache.go') diff --git a/cache/subcache.go b/cache/subcache.go index b0ba6e52..1306428f 100644 --- a/cache/subcache.go +++ b/cache/subcache.go @@ -58,7 +58,7 @@ type SubCache[EntityT entity.Interface, ExcerptT Excerpt, CacheT CacheEntity] st mu sync.RWMutex excerpts map[entity.Id]ExcerptT cached map[entity.Id]CacheT - lru *lruIdCache + lru lruIdCache } func NewSubCache[EntityT entity.Interface, ExcerptT Excerpt, CacheT CacheEntity]( @@ -377,7 +377,7 @@ func (sc *SubCache[EntityT, ExcerptT, CacheT]) Resolve(id entity.Id) (CacheT, er } // ResolvePrefix retrieve an entity matching an id prefix. It fails if multiple -// entity match. +// entities match. func (sc *SubCache[EntityT, ExcerptT, CacheT]) ResolvePrefix(prefix string) (CacheT, error) { return sc.ResolveMatcher(func(excerpt ExcerptT) bool { return excerpt.Id().HasPrefix(prefix) @@ -406,7 +406,7 @@ func (sc *SubCache[EntityT, ExcerptT, CacheT]) ResolveExcerpt(id entity.Id) (Exc } // ResolveExcerptPrefix retrieve an Excerpt matching an id prefix. It fails if multiple -// entity match. +// entities match. func (sc *SubCache[EntityT, ExcerptT, CacheT]) ResolveExcerptPrefix(prefix string) (ExcerptT, error) { return sc.ResolveExcerptMatcher(func(excerpt ExcerptT) bool { return excerpt.Id().HasPrefix(prefix) @@ -629,7 +629,7 @@ func (sc *SubCache[EntityT, ExcerptT, CacheT]) evictIfNeeded() { } // as a form of assurance that evicted entities don't get manipulated, we lock them here. - // if something try to do it anyway, it will lock the program and make it obvious. + // if something tries to do it anyway, it will lock the program and make it obvious. b.Lock() sc.lru.Remove(id) -- cgit