cache

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRemoteCache

func AddRemoteCache(cacheInfo CacheProvider) error

func RemoveRemoteCache

func RemoveRemoteCache() error

Types

type AzureCache

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

Generate ICache implementation

func (*AzureCache) Configure

func (s *AzureCache) Configure(cacheInfo CacheProvider) error

func (*AzureCache) DisableCache

func (s *AzureCache) DisableCache()

func (*AzureCache) Exists

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

func (*AzureCache) GetName

func (s *AzureCache) GetName() string

func (*AzureCache) IsCacheDisabled

func (s *AzureCache) IsCacheDisabled() bool

func (*AzureCache) List

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

func (*AzureCache) Load

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

func (*AzureCache) Remove

func (s *AzureCache) Remove(key string) error

func (*AzureCache) Store

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

type AzureCacheConfiguration

type AzureCacheConfiguration struct {
	StorageAccount string `mapstructure:"storageaccount" yaml:"storageaccount,omitempty"`
	ContainerName  string `mapstructure:"container" yaml:"container,omitempty"`
}

type CacheObjectDetails

type CacheObjectDetails struct {
	Name      string
	UpdatedAt time.Time
}

type CacheProvider

type CacheProvider struct {
	GCS   GCSCacheConfiguration   `mapstructucre:"gcs" yaml:"gcs,omitempty"`
	Azure AzureCacheConfiguration `mapstructucre:"azure" yaml:"azure,omitempty"`
	S3    S3CacheConfiguration    `mapstructucre:"s3" yaml:"s3,omitempty"`
}

func NewCacheProvider

func NewCacheProvider(cacheType, bucketname, region, storageAccount, containerName, projectId string) (CacheProvider, error)

func ParseCacheConfiguration

func ParseCacheConfiguration() (CacheProvider, error)

type FileBasedCache

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

func (*FileBasedCache) Configure

func (f *FileBasedCache) Configure(cacheInfo CacheProvider) error

func (*FileBasedCache) DisableCache

func (s *FileBasedCache) DisableCache()

func (*FileBasedCache) Exists

func (*FileBasedCache) Exists(key string) bool

func (*FileBasedCache) GetName

func (s *FileBasedCache) GetName() string

func (*FileBasedCache) IsCacheDisabled

func (f *FileBasedCache) IsCacheDisabled() bool

func (*FileBasedCache) List

func (*FileBasedCache) Load

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

func (*FileBasedCache) Remove

func (*FileBasedCache) Remove(key string) error

func (*FileBasedCache) Store

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

type GCSCache

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

func (*GCSCache) Configure

func (s *GCSCache) Configure(cacheInfo CacheProvider) error

func (*GCSCache) DisableCache

func (s *GCSCache) DisableCache()

func (*GCSCache) Exists

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

func (*GCSCache) GetName

func (s *GCSCache) GetName() string

func (*GCSCache) IsCacheDisabled

func (s *GCSCache) IsCacheDisabled() bool

func (*GCSCache) List

func (s *GCSCache) List() ([]CacheObjectDetails, error)

func (*GCSCache) Load

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

func (*GCSCache) Remove

func (s *GCSCache) Remove(key string) error

func (*GCSCache) Store

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

type GCSCacheConfiguration

type GCSCacheConfiguration struct {
	ProjectId  string `mapstructure:"projectid" yaml:"projectid,omitempty"`
	Region     string `mapstructure:"region" yaml:"region,omitempty"`
	BucketName string `mapstructure:"bucketname" yaml:"bucketname,omitempty"`
}

type ICache

type ICache interface {
	Configure(cacheInfo CacheProvider) error
	Store(key string, data string) error
	Load(key string) (string, error)
	List() ([]CacheObjectDetails, error)
	Remove(key string) error
	Exists(key string) bool
	IsCacheDisabled() bool
	GetName() string
	DisableCache()
}

func GetCacheConfiguration

func GetCacheConfiguration() (ICache, error)

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

func New

func New(cacheType string) ICache

type S3Cache

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

Generate ICache implementation

func (*S3Cache) Configure

func (s *S3Cache) Configure(cacheInfo CacheProvider) error

func (*S3Cache) DisableCache

func (s *S3Cache) DisableCache()

func (*S3Cache) Exists

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

func (*S3Cache) GetName

func (s *S3Cache) GetName() string

func (*S3Cache) IsCacheDisabled

func (s *S3Cache) IsCacheDisabled() bool

func (*S3Cache) List

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

func (*S3Cache) Load

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

func (*S3Cache) Remove

func (s *S3Cache) Remove(key string) error

func (*S3Cache) Store

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

type S3CacheConfiguration

type S3CacheConfiguration struct {
	Region     string `mapstructure:"region" yaml:"region,omitempty"`
	BucketName string `mapstructure:"bucketname" yaml:"bucketname,omitempty"`
}

Jump to

Keyboard shortcuts

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