cache

package
v0.3.19 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2023 License: Apache-2.0 Imports: 17 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRemoteCache added in v0.3.5

func AddRemoteCache(cache CacheProvider) error

func RemoveRemoteCache added in v0.3.5

func RemoveRemoteCache() error

Types

type AzureCache added in v0.3.19

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

Generate ICache implementation

func (*AzureCache) Exists added in v0.3.19

func (s *AzureCache) Exists(key string) bool

func (*AzureCache) IsCacheDisabled added in v0.3.19

func (s *AzureCache) IsCacheDisabled() bool

func (*AzureCache) List added in v0.3.19

func (s *AzureCache) List() ([]string, error)

func (*AzureCache) Load added in v0.3.19

func (s *AzureCache) Load(key string) (string, error)

func (*AzureCache) Store added in v0.3.19

func (s *AzureCache) Store(key string, data string) error

type CacheProvider added in v0.3.3

type CacheProvider struct {
	BucketName     string `mapstructure:"bucketname" yaml:"bucketname,omitempty"`
	Region         string `mapstructure:"region" yaml:"region,omitempty"`
	StorageAccount string `mapstructure:"storageaccount" yaml:"storageaccount,omitempty"`
	ContainerName  string `mapstructure:"container" yaml:"container,omitempty"`
}

CacheProvider is the configuration for the cache provider when using a remote cache

func NewCacheProvider added in v0.3.19

func NewCacheProvider(bucketname, region, storageaccount, containername string) CacheProvider

NewCacheProvider constructs a new cache struct

type CacheType added in v0.3.19

type CacheType string
const (
	Azure     CacheType = "azure"
	S3        CacheType = "s3"
	FileBased CacheType = "file"
)

func RemoteCacheEnabled added in v0.3.3

func RemoteCacheEnabled() (CacheType, error)

If we have set a remote cache, return the remote cache type

type FileBasedCache

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

func (*FileBasedCache) Exists

func (*FileBasedCache) Exists(key string) bool

func (*FileBasedCache) IsCacheDisabled added in v0.2.8

func (f *FileBasedCache) IsCacheDisabled() bool

func (*FileBasedCache) List added in v0.3.3

func (*FileBasedCache) List() ([]string, error)

func (*FileBasedCache) Load

func (*FileBasedCache) Load(key string) (string, error)

func (*FileBasedCache) Store

func (*FileBasedCache) Store(key string, data string) error

type ICache

type ICache interface {
	Store(key string, data string) error
	Load(key string) (string, error)
	List() ([]string, error)
	Exists(key string) bool
	IsCacheDisabled() bool
}

func New

func New(noCache bool, remoteCache CacheType) ICache

func NewAzureCache added in v0.3.19

func NewAzureCache(nocache bool) ICache

func NewS3Cache added in v0.3.3

func NewS3Cache(nocache bool) ICache

type S3Cache added in v0.3.3

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

Generate ICache implementation

func (*S3Cache) Exists added in v0.3.3

func (s *S3Cache) Exists(key string) bool

func (*S3Cache) IsCacheDisabled added in v0.3.3

func (s *S3Cache) IsCacheDisabled() bool

func (*S3Cache) List added in v0.3.3

func (s *S3Cache) List() ([]string, error)

func (*S3Cache) Load added in v0.3.3

func (s *S3Cache) Load(key string) (string, error)

func (*S3Cache) Store added in v0.3.3

func (s *S3Cache) Store(key string, data string) error

Jump to

Keyboard shortcuts

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