init
This commit is contained in:
23
pkg/cache/cache.go
vendored
Normal file
23
pkg/cache/cache.go
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
package cache
|
||||
|
||||
import "git.yetaga.in/deltamualpha/libyear/pkg/libyear"
|
||||
|
||||
// Cache isn't concurrency-safe, but we don't care about that right now
|
||||
type Cache struct {
|
||||
items map[string]libyear.Info
|
||||
}
|
||||
|
||||
func (c *Cache) Get(k string) libyear.Info {
|
||||
i, ok := c.items[k]
|
||||
if ok {
|
||||
return i
|
||||
}
|
||||
return libyear.Info{}
|
||||
}
|
||||
|
||||
func (c *Cache) Set(k string, v libyear.Info) {
|
||||
if c.items == nil {
|
||||
c.items = make(map[string]libyear.Info)
|
||||
}
|
||||
c.items[k] = v
|
||||
}
|
Reference in New Issue
Block a user