MCPcopy
hub / github.com/perkeep/perkeep / cacheScaled

Method cacheScaled

pkg/server/image.go:116–123  ·  view source on GitHub ↗

cacheScaled saves in the image handler's cache the scaled image bytes in thumbBytes, and puts its blobref in the scaledImage under the key name.

(ctx context.Context, thumbBytes []byte, name string)

Source from the content-addressed store, hash-verified

114// cacheScaled saves in the image handler's cache the scaled image bytes
115// in thumbBytes, and puts its blobref in the scaledImage under the key name.
116func (ih *ImageHandler) cacheScaled(ctx context.Context, thumbBytes []byte, name string) error {
117 br, err := writeToCache(ctx, ih.Cache, thumbBytes, name)
118 if err != nil {
119 return err
120 }
121 ih.ThumbMeta.Put(name, br)
122 return nil
123}
124
125// cached returns a FileReader for the given blobref, which may
126// point to either a blob representing the entire thumbnail (max

Callers 1

ServeHTTPMethod · 0.95

Calls 2

writeToCacheFunction · 0.85
PutMethod · 0.45

Tested by

no test coverage detected