d8bb261c6432 — Ted Unangst 2 months ago
can eliminate one cache
1 files changed, 6 insertions(+), 17 deletions(-)

M fun.go
M fun.go +6 -17
@@ 578,23 578,6 @@ func quickrename(s string, userid UserID
 	return s
 }
 
-var shortnames = gencache.New(gencache.Options[UserID, map[string]string]{Fill: func(userid UserID) (map[string]string, bool) {
-	honkers := gethonkers(userid)
-	m := make(map[string]string)
-	for _, h := range honkers {
-		m[h.XID] = h.Name
-	}
-	return m, true
-}, Invalidator: &honkerinvalidator})
-
-func shortname(userid UserID, xid string) string {
-	m, ok := shortnames.Get(userid)
-	if ok {
-		return m[xid]
-	}
-	return ""
-}
-
 var honkerdirectory = gencache.New(gencache.Options[UserID, map[string]*Honker]{Fill: func(userid UserID) (map[string]*Honker, bool) {
 	honkers := gethonkers(userid)
 	m := make(map[string]*Honker)

          
@@ 611,6 594,12 @@ func gethonker(userid UserID, xid string
 	}
 	return nil
 }
+func shortname(userid UserID, xid string) string {
+	if h := gethonker(userid, xid); h != nil {
+		return h.Name
+	}
+	return ""
+}
 
 var fullnames = gencache.New(gencache.Options[UserID, map[string]string]{Fill: func(userid UserID) (map[string]string, bool) {
 	honkers := gethonkers(userid)