mem

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStore

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

FileStore implements FileStore completely in memory and uses an LRU cache to limit memory usage

func New

func New(size int, ttl time.Duration) *FileStore

New returns a new FileStore with the given cache size (item count) and item ttl

func (*FileStore) Get

func (m *FileStore) Get(path string) ([]byte, error)

Get returns the file at the given path and removes it

func (*FileStore) Peek

func (m *FileStore) Peek(path string) ([]byte, error)

Peek returns the file at the given path without removing it

func (*FileStore) Put

func (m *FileStore) Put(name string, data []byte) (string, error)

Put stores the data and returns a path with format "<random id>/<name>"

Jump to

Keyboard shortcuts

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