aboutsummaryrefslogtreecommitdiff
path: root/backend/fetchers/cache.go
diff options
context:
space:
mode:
authorGuillermo Serrahima <dev@vylion.com>2026-03-18 22:02:13 +0100
committerGuillermo Serrahima <dev@vylion.com>2026-03-20 00:50:46 +0100
commit59545c874d8635c39ccdbecf84f953686dd5c03c (patch)
tree2c0e682acd56925c2a65dcf2c96a22c95202e550 /backend/fetchers/cache.go
parent9181a6e454e3b294004923b2036b9852212cce7f (diff)
downloadllostre-59545c874d8635c39ccdbecf84f953686dd5c03c.tar.xz
llostre-59545c874d8635c39ccdbecf84f953686dd5c03c.zip
more naming refactors
Diffstat (limited to 'backend/fetchers/cache.go')
-rw-r--r--backend/fetchers/cache.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/backend/fetchers/cache.go b/backend/fetchers/cache.go
index b863d60..01c37fe 100644
--- a/backend/fetchers/cache.go
+++ b/backend/fetchers/cache.go
@@ -1,7 +1,6 @@
package fetchers
import (
- "llostre/backend/general"
"llostre/backend/notes"
"sync"
"time"
@@ -14,14 +13,14 @@ type CacheEntry struct {
type Cache struct {
posts map[string]*CacheEntry
- profiles map[string]*ProfileCacheEntry
+ profiles map[string]*AuthorCacheEntry
mu sync.RWMutex
}
func NewCache() *Cache {
return &Cache{
posts: make(map[string]*CacheEntry),
- profiles: make(map[string]*ProfileCacheEntry),
+ profiles: make(map[string]*AuthorCacheEntry),
}
}
@@ -77,12 +76,12 @@ func (c *Cache) GetMany(uris []string) map[string]*notes.Note {
return result
}
-type ProfileCacheEntry struct {
- Profile *general.Profile
+type AuthorCacheEntry struct {
+ Author *notes.Author
ExpiresAt time.Time
}
-func (c *Cache) GetProfile(did string) (*general.Profile, bool) {
+func (c *Cache) GetProfile(did string) (*notes.Author, bool) {
c.mu.Lock()
defer c.mu.Unlock()
@@ -96,15 +95,15 @@ func (c *Cache) GetProfile(did string) (*general.Profile, bool) {
return nil, false
}
- return entry.Profile, true
+ return entry.Author, true
}
-func (c *Cache) SetProfile(did string, profile *general.Profile) {
+func (c *Cache) SetAuthor(did string, author *notes.Author) {
c.mu.Lock()
defer c.mu.Unlock()
- c.profiles[did] = &ProfileCacheEntry{
- Profile: profile,
+ c.profiles[did] = &AuthorCacheEntry{
+ Author: author,
ExpiresAt: time.Now().Add(15 * time.Minute),
}
}