inmemory

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package inmemory implements storage in memory map.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemory

type InMemory struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

InMemory is the base inmemory type.

func NewStorage

func NewStorage() (*InMemory, error)

NewStorage returns new storage struct.

func (*InMemory) Close

func (im *InMemory) Close() error

Close closes storage.

func (*InMemory) Delete

func (im *InMemory) Delete(item entities.CacheItem) error

Delete deletes item in the storage.

func (*InMemory) IsItemExist

func (im *InMemory) IsItemExist(hash string) (bool, string)

IsItemExist checks if item in the storage.

func (*InMemory) Load

func (im *InMemory) Load(hash string) (entities.CacheItem, error)

Load loads item from the storage.

func (*InMemory) Save

func (im *InMemory) Save(item entities.CacheItem) (bool, error)

Save saves item in the storage.

Jump to

Keyboard shortcuts

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