localcache

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ModuleName = "localcache.star"
View Source
const Name = "localcache"

Variables

View Source
var Module = &starlarkstruct.Module{
	Name: "localcache",
	Members: starlark.StringDict{
		"new": localctx.AddBuiltin("localcache.new", NewLocalCache),
	},
}

Functions

func NewLocalCache

func NewLocalCache(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

NewLocalCache 默认磁盘cache, 如果开启内存cache需要memory=True

Types

type CacheManager

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

localCache singleton cache

func (*CacheManager) GetByDir

func (c *CacheManager) GetByDir(dir string) *LocalCache

type LocalCache

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

func (*LocalCache) Clear

func (l *LocalCache) Clear(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*LocalCache) Delete

func (l *LocalCache) Delete(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*LocalCache) Exist

func (l *LocalCache) Exist(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*LocalCache) Filter

func (l *LocalCache) Filter(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*LocalCache) FilterKey

func (l *LocalCache) FilterKey(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*LocalCache) Get

func (l *LocalCache) Get(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*LocalCache) Set

func (l *LocalCache) Set(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*LocalCache) SetWithTTL

func (l *LocalCache) SetWithTTL(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*LocalCache) Struct

func (l *LocalCache) Struct() *starlarkstruct.Struct

type Store

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

func NewMemStore

func NewMemStore() (*Store, error)

func NewStore

func NewStore(path string) (*Store, error)

func (*Store) Clear

func (s *Store) Clear(prefix []byte) error

func (*Store) Close

func (s *Store) Close() error

func (*Store) Delete

func (s *Store) Delete(k []byte) error

func (*Store) Exist

func (s *Store) Exist(k []byte) bool

func (*Store) Filter

func (s *Store) Filter(prefix []byte) (map[string][]byte, error)

func (*Store) FilterKey

func (s *Store) FilterKey(prefix []byte) (keys [][]byte, err error)

func (*Store) Get

func (s *Store) Get(k []byte) ([]byte, error)

func (*Store) Set

func (s *Store) Set(k, v []byte) error

func (*Store) SetWithTTL

func (s *Store) SetWithTTL(k, v []byte, duration time.Duration) error

Jump to

Keyboard shortcuts

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