angularpatternsstore

package
v0.0.0-testrgm6 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KVStoreService

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

KVStoreService allows to cache GCOM angular patterns into the database, as a cache.

func (*KVStoreService) Get

func (s *KVStoreService) Get(ctx context.Context) (string, bool, error)

Get returns the raw cached angular detection patterns. The returned value is a JSON-encoded string. If no value is present, the second argument is false and the returned error is nil.

func (*KVStoreService) GetLastUpdated

func (s *KVStoreService) GetLastUpdated(ctx context.Context) (time.Time, error)

GetLastUpdated returns the time when Set was last called. If the value cannot be unmarshalled correctly, it returns a zero-value time.Time.

func (*KVStoreService) Set

func (s *KVStoreService) Set(ctx context.Context, patterns any) error

Set sets the cached angular detection patterns and the latest update time to time.Now(). patterns must implement json.Marshaler.

type Service

type Service interface {
	Get(ctx context.Context) (string, bool, error)
	Set(ctx context.Context, patterns any) error
	GetLastUpdated(ctx context.Context) (time.Time, error)
}

func ProvideService

func ProvideService(kv kvstore.KVStore) Service

Jump to

Keyboard shortcuts

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