memory

package
v0.0.0-...-0345585 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2014 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package memory provides an in-memory Image Cache

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryCache

type MemoryCache struct {
	// contains filtered or unexported fields
}

MemoryCache represents an in-memory Image Cache

It uses an LRU implementation from https://github.com/pierrre/lrucache (copy of https://github.com/youtube/vitess/tree/master/go/cache)

func New

func New(capacity int64) *MemoryCache

New creates a MemoryCache

capacity is the maximum cache size (in bytes)

func (*MemoryCache) Get

func (cache *MemoryCache) Get(key string, parameters imageserver.Parameters) (*imageserver.Image, error)

Get gets an image from the in-memory Cache

func (*MemoryCache) Set

func (cache *MemoryCache) Set(key string, image *imageserver.Image, parameters imageserver.Parameters) error

Set sets an Image to the in-memory Cache

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL