store

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilesystemData

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

FilesystemData represens data in file on filesystem

type FilesystemStore

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

FileStore uses filesystem to store data

func NewFilesystem

func NewFilesystem(basePath string, expiration time.Duration) *FilesystemStore

NewFilesystem create a new FilesystemStore

func (FilesystemStore) Get

func (store FilesystemStore) Get(key string) ([]byte, error)

Get data from store with given key

func (*FilesystemStore) Set

func (store *FilesystemStore) Set(key string, data []byte) error

Put data to store fore given key

type InMemoryData

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

InMemoryData represens data in memory store

type InMemoryStore

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

InMemoryStore uses in memory

func NewInMemoryStore

func NewInMemoryStore(expiration time.Duration) *InMemoryStore

NewInMemoryStore create a new InMemoryStore

func (InMemoryStore) Get

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

Get data from store with given key

func (*InMemoryStore) Set

func (store *InMemoryStore) Set(key string, data []byte) error

Put data to store fore given key

type RedisStore

type RedisStore struct {
	Client *redis.Client
	// contains filtered or unexported fields
}

RedisStore uses Redis

func NewRedisStore

func NewRedisStore(endpoint string, port int, username, password string, expiration time.Duration) *RedisStore

NewRedisStore creates a new RedisStore. Use empty string for username & password if not password required. Set port to 0 to use default.

func (RedisStore) Get

func (store RedisStore) Get(key string) ([]byte, error)

Get data from store with given key

func (RedisStore) Set

func (store RedisStore) Set(key string, data []byte) error

Put data to store fore given key

type Store

type Store interface {
	Get(key string) ([]byte, error)
	Set(key string, data []byte) error
}

Store represents a store

Jump to

Keyboard shortcuts

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