store

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package store syncs multiple go-micro stores

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	store.Store

	// Force a full sync
	Sync() error
}

Cache implements a cache in front of go-micro Stores

func NewCache

func NewCache(opts ...Option) Cache

NewCache returns a new Cache

type Option

type Option func(o *Options)

Option sets Cache Options

func Stores

func Stores(stores ...store.Store) Option

Stores sets the layers that make up the cache

func SyncInterval

func SyncInterval(d time.Duration) Option

SyncInterval sets the duration between syncs from L0 to L1

func SyncMultiplier

func SyncMultiplier(i int64) Option

SyncMultiplier sets the multiplication factor for time to wait each cache layer

type Options

type Options struct {
	// Stores represents layers in the cache in ascending order. L0, L1, L2, etc
	Stores []store.Store
	// SyncInterval is the duration between syncs from L0 to L1
	SyncInterval time.Duration
	// SyncMultiplier is the multiplication factor between each store.
	SyncMultiplier int64
}

Options represents Cache options

Jump to

Keyboard shortcuts

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