file

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyExpired = errors.New("key expired")
)
View Source
var (
	NullString = nulltype.NullString{}
)

Functions

This section is empty.

Types

type CacheImpl

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

func (*CacheImpl) Del

func (r *CacheImpl) Del(key string) error

func (*CacheImpl) Expire

func (r *CacheImpl) Expire(key string, ttl time.Duration) error

func (*CacheImpl) Get

func (r *CacheImpl) Get(key string) (nulltype.NullString, error)

func (*CacheImpl) GetBytes

func (r *CacheImpl) GetBytes(key string) ([]byte, error)

func (*CacheImpl) Range

func (r *CacheImpl) Range() ([]*KV, error)

func (*CacheImpl) Set

func (r *CacheImpl) Set(key, val string, ttl time.Duration) error

func (*CacheImpl) SetBytes

func (r *CacheImpl) SetBytes(key string, val []byte, ttl time.Duration) error

func (*CacheImpl) TTL

func (r *CacheImpl) TTL(key string) (time.Duration, error)

type FileCache

type FileCache interface {
	GetBytes(key string) ([]byte, error)
	Get(key string) (nulltype.NullString, error)
	SetBytes(key string, val []byte, ttl time.Duration) error
	Set(key, val string, ttl time.Duration) error
	TTL(key string) (time.Duration, error)
	Expire(key string, ttl time.Duration) error
	Del(key string) error
	Range() ([]*KV, error)
}

func New

func New(filepath string) FileCache

type KV

type KV struct {
	Key string
	Val string
	TTL time.Duration
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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