add documentation
This commit is contained in:
5
pkg/cache/cache.go
vendored
5
pkg/cache/cache.go
vendored
@@ -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)
|
||||
|
Reference in New Issue
Block a user