presistence

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultExpire 0 second expire duration
	DefaultExpire = time.Duration(0)
	// ForeverExpire forever expire duration
	ForeverExpire = time.Duration(-1)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemoryStore

type InMemoryStore struct {
	Cache *cache.Cache
}

InMemoryStore to save cache into memory can be read and write

func NewInMemoryStore

func NewInMemoryStore() *InMemoryStore

NewInMemoryStore ...

func (*InMemoryStore) Delete

func (s *InMemoryStore) Delete(key string) error

Delete func implement presistence.Store interface

func (*InMemoryStore) Exists

func (s *InMemoryStore) Exists(key string) bool

Exists func implement presistence.Store interface

func (*InMemoryStore) Flush

func (s *InMemoryStore) Flush() error

Flush func implement presistence.Store interface

func (*InMemoryStore) Get

func (s *InMemoryStore) Get(key string) ([]byte, error)

Get func implement presistence.Store interface

func (*InMemoryStore) Replace

func (s *InMemoryStore) Replace(
	key string, newVal []byte, expire time.Duration) error

Replace func implement presistence.Store interface

func (*InMemoryStore) Set

func (s *InMemoryStore) Set(key string, value []byte, expire time.Duration) error

Set func implement presistence.Store interface

type Store

type Store interface {

	// Set func to Set item with params
	Set(key string, value []byte, expire time.Duration) error

	// Get func to Get item with params
	Get(key string) ([]byte, error)

	// Replace func to Replace item with params
	Replace(key string, newVal []byte, expire time.Duration) error

	// Exists func to Exists item with params
	Exists(key string) bool

	// Delete func to Delete item with params
	Delete(key string) error

	// Flush func to flush all data
	Flush() error
}

Store interface to presist data into database or file etc.

Jump to

Keyboard shortcuts

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