pegasus

package
v2.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: MIT, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PegasusType represents the storage type as a string value
	PegasusType = "pegasus"
	// PegasusTagPattern represents the tag pattern to be used as a key in specified storage
	PegasusTagPattern = "gocache_tag_%s"
	// Pegasus ttl(time-to-live) in seconds: -1 if ttl is not set; -2 if entry doesn't exist
	PegasusNOTTL   = -1
	PegasusNOENTRY = -2

	DefaultTable             = "gocache_pegasus"
	DefaultTablePartitionNum = 4
	DefaultScanNum           = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type OptionsPegasus

type OptionsPegasus struct {
	*lib_store.Options
	MetaServers []string

	TableName         string
	TablePartitionNum int
	TableScanNum      int
}

OptionsPegasus is options of Pegasus

type PegasusStore

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

PegasusStore is a store for Pegasus

func NewPegasus

func NewPegasus(ctx context.Context, options *OptionsPegasus) (*PegasusStore, error)

NewPegasus creates a new store to pegasus instance(s)

func (*PegasusStore) Clear

func (p *PegasusStore) Clear(ctx context.Context) error

Clear resets all data in the store

func (*PegasusStore) Close

func (p *PegasusStore) Close() error

Close when exit store

func (*PegasusStore) Delete

func (p *PegasusStore) Delete(ctx context.Context, key any) error

Delete removes data from Pegasus for given key identifier

func (*PegasusStore) Get

func (p *PegasusStore) Get(ctx context.Context, key any) (any, error)

Get returns data stored from a given key

func (*PegasusStore) GetType

func (p *PegasusStore) GetType() string

GetType returns the store type

func (*PegasusStore) GetWithTTL

func (p *PegasusStore) GetWithTTL(ctx context.Context, key any) (any, time.Duration, error)

GetWithTTL returns data stored from a given key and its corresponding TTL

func (*PegasusStore) Invalidate

func (p *PegasusStore) Invalidate(ctx context.Context, options ...lib_store.InvalidateOption) error

Invalidate invalidates some cache data in Pegasus for given options

func (*PegasusStore) Set

func (p *PegasusStore) Set(ctx context.Context, key, value any, options ...lib_store.Option) error

Set defines data in Pegasus for given key identifier

Jump to

Keyboard shortcuts

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