level

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: AGPL-3.0 Imports: 8 Imported by: 2

Documentation

Overview

Package level implements the cacheme.Backend interface using LevelDB as its storage backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache is an implementation of the cacheme.Backend interface, using LevelDB as its backend to provide persistence.

func New

func New(path string) (*Cache, error)

New creates a new LevelCache that stores its data at the given path.

func (*Cache) Delete

func (l *Cache) Delete(key string) error

Delete removes the given key and its value from the Cache.

func (*Cache) Flush

func (l *Cache) Flush() (e error)

Flush removes ALL key-value-pairs from the Cache.

func (*Cache) Install

func (l *Cache) Install(key, val string, ttl time.Duration) error

Install adds a key-value-pair with the given TTL to the Cache. If the key already exists, it is silently replaced.

func (*Cache) Lookup

func (l *Cache) Lookup(key string) (string, bool, time.Time, error)

Lookup looks up the given key. If the key is found AND has not yet expired, the associated value is returned.

func (*Cache) Purge

func (l *Cache) Purge() (e error)

Purge removes all key-value-pairs that have expired from the Cache.

Jump to

Keyboard shortcuts

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