inmemory

package
v0.6.30 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrParsing = errors.New("parsing error")

Functions

This section is empty.

Types

type Cache

type Cache struct {
	*ristretto.Cache
	// contains filtered or unexported fields
}

func NewCache

func NewCache(cfg Config) (Cache, error)

func (Cache) MonitorCache

func (c Cache) MonitorCache(meter metric.Meter) error

type CachedGroupRepository

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

func NewCachedGroupRepository

func NewCachedGroupRepository(cache Cache, repository GroupRepository) *CachedGroupRepository

func (CachedGroupRepository) GetBySlug

func (r CachedGroupRepository) GetBySlug(ctx context.Context, slug string) (group.Group, error)

type Config

type Config struct {
	NumCounters  int64 `yaml:"num_counters" mapstructure:"num_counters"  default:"10000000"`
	MaxCost      int64 `yaml:"max_cost" mapstructure:"max_cost"  default:"1073741824"`
	BufferItems  int64 `yaml:"buffer_items" mapstructure:"buffer_items"  default:"64"`
	Metrics      bool  `yaml:"metrics" mapstructure:"metrics"  default:"true"`
	TTLInSeconds int   `yaml:"ttl_in_seconds" mapstructure:"ttl_in_seconds"  default:"3600"`
}

type GroupRepository

type GroupRepository interface {
	GetBySlug(ctx context.Context, slug string) (group.Group, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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