lru

package module
v0.0.0-...-8a91141 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: MIT Imports: 4 Imported by: 0

README

This repository has been archived!

This IPFS-related repository has been archived, and all issues are therefore frozen. If you want to ask a question or open/continue a discussion related to this repo, please visit the official IPFS forums.

We archive repos for one or more of the following reasons:

  • Code or content is unmaintained, and therefore might be broken
  • Content is outdated, and therefore may mislead readers
  • Code or content evolved into something else and/or has lived on in a different place
  • The repository or project is not active in general

Please note that in order to keep the primary IPFS GitHub org tidy, most archived repos are moved into the ipfs-inactive org.

If you feel this repo should not be archived (or portions of it should be moved to a non-archived repo), please reach out and let us know. Archiving can always be reversed if needed.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datastore

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

Datastore uses golang-lru for internal storage.

func NewDatastore

func NewDatastore(capacity int) (*Datastore, error)

NewDatastore constructs a new LRU Datastore with given capacity.

func (*Datastore) Batch

func (d *Datastore) Batch() (ds.Batch, error)

func (*Datastore) Close

func (d *Datastore) Close() error

func (*Datastore) Delete

func (d *Datastore) Delete(key ds.Key) (err error)

Delete removes the value for given `key`.

func (*Datastore) Get

func (d *Datastore) Get(key ds.Key) (value interface{}, err error)

Get retrieves the object `value` named by `key`.

func (*Datastore) Has

func (d *Datastore) Has(key ds.Key) (exists bool, err error)

Has returns whether the `key` is mapped to a `value`.

func (*Datastore) Put

func (d *Datastore) Put(key ds.Key, value interface{}) (err error)

Put stores the object `value` named by `key`.

func (*Datastore) Query

func (d *Datastore) Query(q dsq.Query) (dsq.Results, error)

KeyList returns a list of keys in the datastore

Jump to

Keyboard shortcuts

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