cache

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

View Source
const (
	JsonFileNamePrefix = "stage_"
	JsonFileNameSuffix = ".json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileCacheSecretStoreStrategy

type FileCacheSecretStoreStrategy struct {
	// 缓存凭据文件路径
	CacheSecretPath string
	// 首次启动时候是否允许从文件进行加载,true为允许
	ReloadOnStart bool
	//加解密过程中使用的salt
	Salt               string
	ReloadedSet        mapset.Set
	CacheSecretInfoMap cmap.ConcurrentMap
}

func NewFileCacheSecretStoreStrategy

func NewFileCacheSecretStoreStrategy(cacheSecretPath string, reloadOnStart bool, salt string) *FileCacheSecretStoreStrategy

func (*FileCacheSecretStoreStrategy) Close

func (fs *FileCacheSecretStoreStrategy) Close() error

func (*FileCacheSecretStoreStrategy) GetCacheSecretInfo

func (fs *FileCacheSecretStoreStrategy) GetCacheSecretInfo(secretName string) (*models.CacheSecretInfo, error)

func (*FileCacheSecretStoreStrategy) Init

func (*FileCacheSecretStoreStrategy) StoreSecret

func (fs *FileCacheSecretStoreStrategy) StoreSecret(cacheSecretInfo *models.CacheSecretInfo) error

type MemoryCacheSecretStoreStrategy

type MemoryCacheSecretStoreStrategy struct {
	CacheSecretInfoMap cmap.ConcurrentMap
}

func NewMemoryCacheSecretStoreStrategy

func NewMemoryCacheSecretStoreStrategy() *MemoryCacheSecretStoreStrategy

func (*MemoryCacheSecretStoreStrategy) Close

func (*MemoryCacheSecretStoreStrategy) GetCacheSecretInfo

func (ms *MemoryCacheSecretStoreStrategy) GetCacheSecretInfo(secretName string) (*models.CacheSecretInfo, error)

func (*MemoryCacheSecretStoreStrategy) Init

func (*MemoryCacheSecretStoreStrategy) StoreSecret

func (ms *MemoryCacheSecretStoreStrategy) StoreSecret(cacheSecretInfo *models.CacheSecretInfo) error

type SecretCacheHook

type SecretCacheHook interface {
	// 初始化Hook
	Init() error

	// 将secret对象转化为Cache secret对象
	Put(o *models.SecretInfo) (*models.CacheSecretInfo, error)

	// 将Cache secret对象转化为secret对象
	Get(cachedObject *models.CacheSecretInfo) (*models.SecretInfo, error)

	// RecoveryGetSecret
	RecoveryGetSecret(secretName string) (*models.SecretInfo, error)

	// 关闭,释放资源
	Close() error
}

func NewDefaultSecretCacheHook

func NewDefaultSecretCacheHook(stage string) SecretCacheHook

type SecretCacheStoreStrategy

type SecretCacheStoreStrategy interface {
	// 初始化凭据缓存
	Init() error

	// 缓存secret信息
	StoreSecret(cacheSecretInfo *models.CacheSecretInfo) error

	// 获取secret缓存信息
	GetCacheSecretInfo(secretName string) (*models.CacheSecretInfo, error)

	// 关闭,释放资源
	Close() error
}

SecretCacheStoreStrategy 缓存secret策略

Jump to

Keyboard shortcuts

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