memory

package
v2.3.1-beta.4 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const PluginName string = "memory"

Variables

This section is empty.

Functions

func NewInMemoryDriver

func NewInMemoryDriver(log logger.Logger, key string, cfgPlugin config.Configurer, stop chan struct{}) (kv.Storage, error)

func NewPubSubDriver

func NewPubSubDriver(log logger.Logger, _ string) (pubsub.PubSub, error)

Types

type Config

type Config struct {
	// Interval for the check
	Interval int
}

Config is default config for the in-memory driver

func (*Config) InitDefaults

func (c *Config) InitDefaults()

InitDefaults by default driver is turned off

type Driver

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

func (*Driver) Delete

func (s *Driver) Delete(keys ...string) error

func (*Driver) Get

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

func (*Driver) Has

func (s *Driver) Has(keys ...string) (map[string]bool, error)

func (*Driver) MExpire

func (s *Driver) MExpire(items ...*kvv1.Item) error

MExpire sets the expiration time to the key If key already has the expiration time, it will be overwritten

func (*Driver) MGet

func (s *Driver) MGet(keys ...string) (map[string][]byte, error)

func (*Driver) Set

func (s *Driver) Set(items ...*kvv1.Item) error

func (*Driver) TTL

func (s *Driver) TTL(keys ...string) (map[string]string, error)

type Plugin

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

func (*Plugin) Init

func (p *Plugin) Init(log logger.Logger, cfg config.Configurer) error

func (*Plugin) KVConstruct

func (p *Plugin) KVConstruct(key string) (kv.Storage, error)

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) PSConstruct

func (p *Plugin) PSConstruct(key string) (pubsub.PubSub, error)

func (*Plugin) Serve

func (p *Plugin) Serve() chan error

func (*Plugin) Stop

func (p *Plugin) Stop() error

type PubSubDriver

type PubSubDriver struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*PubSubDriver) Connections

func (p *PubSubDriver) Connections(topic string, res map[string]struct{})

func (*PubSubDriver) Next

func (p *PubSubDriver) Next() (*pubsub.Message, error)

func (*PubSubDriver) Publish

func (p *PubSubDriver) Publish(msg *pubsub.Message) error

func (*PubSubDriver) PublishAsync

func (p *PubSubDriver) PublishAsync(msg *pubsub.Message)

func (*PubSubDriver) Subscribe

func (p *PubSubDriver) Subscribe(connectionID string, topics ...string) error

func (*PubSubDriver) Unsubscribe

func (p *PubSubDriver) Unsubscribe(connectionID string, topics ...string) error

Jump to

Keyboard shortcuts

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