add documentation

This commit is contained in:
2021-05-09 17:25:23 -04:00
parent 1ee89cad34
commit 573de70682
5 changed files with 45 additions and 17 deletions

5
pkg/cache/cache.go vendored
View File

@@ -2,11 +2,13 @@ package cache
import "git.yetaga.in/alazyreader/libyear/pkg/libyear"
// Cache isn't concurrency-safe, but we don't care about that right now
// Cache holds maps of strings to Info structs.
// It isn't concurrency-safe, but we don't care about that right now.
type Cache struct {
items map[string]libyear.Info
}
// Get retrives an Info struct from the cache, if it exists.
func (c *Cache) Get(k string) libyear.Info {
i, ok := c.items[k]
if ok {
@@ -15,6 +17,7 @@ func (c *Cache) Get(k string) libyear.Info {
return libyear.Info{}
}
// Set adds an Info struct to the cache.
func (c *Cache) Set(k string, v libyear.Info) {
if c.items == nil {
c.items = make(map[string]libyear.Info)