ttlstore

package
v0.0.0-...-b4bca67 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminHandler

type AdminHandler struct {
	Store     TtlStore
	KeyPrefix string
}

func (*AdminHandler) ServeHTTP

func (h *AdminHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

type SimpleTtlStore

type SimpleTtlStore struct {
	MaxSize int
	// contains filtered or unexported fields
}

func (*SimpleTtlStore) Add

func (s *SimpleTtlStore) Add(key string, val []byte, ttl uint32) error

func (*SimpleTtlStore) Delete

func (s *SimpleTtlStore) Delete(key string)

func (*SimpleTtlStore) Find

func (s *SimpleTtlStore) Find(val []byte, prefix string) string

func (*SimpleTtlStore) FindAll

func (s *SimpleTtlStore) FindAll(val []byte, prefix string) (keys []string)

func (*SimpleTtlStore) Get

func (s *SimpleTtlStore) Get(key string) []byte

func (*SimpleTtlStore) List

func (s *SimpleTtlStore) List(prefix string) (keys []string)

func (*SimpleTtlStore) LoadFile

func (s *SimpleTtlStore) LoadFile(path string) error

func (*SimpleTtlStore) Prune

func (s *SimpleTtlStore) Prune()

func (*SimpleTtlStore) PrunePeriodically

func (s *SimpleTtlStore) PrunePeriodically(interval time.Duration)

func (*SimpleTtlStore) Remove

func (s *SimpleTtlStore) Remove(key string, val []byte)

func (*SimpleTtlStore) Set

func (s *SimpleTtlStore) Set(key string, val []byte, ttl uint32) error

func (*SimpleTtlStore) Size

func (s *SimpleTtlStore) Size() int

func (*SimpleTtlStore) Values

func (s *SimpleTtlStore) Values(key string) (vals [][]byte)

func (*SimpleTtlStore) WriteFile

func (s *SimpleTtlStore) WriteFile(path string) error

func (*SimpleTtlStore) WriteFilePeriodically

func (s *SimpleTtlStore) WriteFilePeriodically(path string, interval time.Duration) error

type TtlStore

type TtlStore interface {
	// appends val to any other values associated with key
	Add(key string, val []byte, ttl uint32) error
	// associates val with key, replacing any other values
	Set(key string, val []byte, ttl uint32) error
	// gets all keys starting with prefix
	List(prefix string) []string
	// gets the first key starting with prefix found associated with val
	Find(val []byte, prefix string) string
	// gets all keys starting with prefix found associated with val
	FindAll(val []byte, prefix string) []string
	// gets all non-expired values associated with key
	Values(key string) [][]byte
	// gets the first non-expired value associated with key
	Get(key string) []byte
	// unassociates val with key, leaving any other values
	Remove(key string, val []byte)
	// deletes all values associated with key
	Delete(key string)
}

type ValueWithExpiration

type ValueWithExpiration struct {
	Expires uint32
	Value   []byte
}

Jump to

Keyboard shortcuts

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