Files
opencloud/pkg/thumbnails/cache/inmemory.go
David Christofas a98df0b11f first prototype of the thumbnail service
Currently uses in memory caching and loads the file from the local
filesystem.
2020-03-03 16:40:09 +01:00

23 lines
421 B
Go

package cache
import "image"
func NewInMemoryCache() InMemoryCache {
return InMemoryCache{
store: make(map[string]image.Image),
}
}
type InMemoryCache struct {
store map[string]image.Image
}
func (fsc InMemoryCache) Get(key string) image.Image {
return fsc.store[key]
}
func (fsc InMemoryCache) Set(key string, thumbnail image.Image) (image.Image, error) {
fsc.store[key] = thumbnail
return thumbnail, nil
}