cache

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("key not found in cache")
View Source
var LocalCacheExpirationInSec = 600 // 10 min
View Source
var LocalCacheSize = 10 * 1024 * 1024 // 10 0MB
View Source
var NotCachableError = errors.New("not cachable")

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Time  time.Time              `json:"time"`
	Value map[string]interface{} `json:"value"`
}

type LocalCache

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

func NewLocal

func NewLocal() *LocalCache

func (*LocalCache) Get

func (this *LocalCache) Get(key string) (value []byte, err error)

func (*LocalCache) Set

func (this *LocalCache) Set(key string, value []byte)

func (*LocalCache) Use

func (this *LocalCache) Use(key string, getter func() (interface{}, error), result interface{}) (err error)

type RemoteCache

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

func NewRemote

func NewRemote(config configuration.Config, deviceRepo api.Controller, deviceSelection deviceSelection.Client) *RemoteCache

func (*RemoteCache) GetConcept

func (this *RemoteCache) GetConcept(conceptId string) (concept models.Concept, err error)

func (*RemoteCache) GetDevice added in v0.0.2

func (this *RemoteCache) GetDevice(deviceId string, token string) (device models.Device, err error)

func (*RemoteCache) GetDeviceGroup added in v0.0.2

func (this *RemoteCache) GetDeviceGroup(deviceGroupId string, token string) (deviceGroup models.DeviceGroup, err error)

func (*RemoteCache) GetFunction added in v0.0.2

func (this *RemoteCache) GetFunction(functionId string) (function models.Function, err error)

func (*RemoteCache) GetLastValuesFromCache

func (lv *RemoteCache) GetLastValuesFromCache(request model.QueriesRequestElement) ([][]interface{}, error)

func (*RemoteCache) GetSecretQuery

func (this *RemoteCache) GetSecretQuery(secret string) (query model.PreparedQueriesRequestElement, err error)

func (*RemoteCache) GetSelectables added in v0.0.2

func (this *RemoteCache) GetSelectables(userid string, token string, criteria []models.DeviceGroupFilterCriteria, options *deviceSelection.GetSelectablesOptions) (res []dsmodel.Selectable, code int, err error)

func (*RemoteCache) GetService

func (this *RemoteCache) GetService(serviceId string) (service models.Service, err error)

func (*RemoteCache) StoreSecretQuery

func (this *RemoteCache) StoreSecretQuery(query model.PreparedQueriesRequestElement) (secret string, err error)

Jump to

Keyboard shortcuts

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