Documentation ¶
Index ¶
- Constants
- type BaseManager
- func (bm *BaseManager) CacheClient(_ context.Context) cache.Cache
- func (bm *BaseManager) CountCache(ctx context.Context) (int64, error)
- func (bm *BaseManager) DeleteCache(ctx context.Context, key string) error
- func (bm *BaseManager) FlushAll(ctx context.Context) error
- func (bm *BaseManager) ResourceType(_ context.Context) string
- func (bm *BaseManager) WithCacheClient(cc cache.Cache) *BaseManager
- type Manager
- type ObjectKey
Constants ¶
View Source
const ( // Resource type definitions // ResourceTypeArtifact defines artifact type. ResourceTypeArtifact = "artifact" // ResourceTypeProject defines project type. ResourceTypeProject = "project" // ResourceTypeProject defines project metadata type. ResourceTypeProjectMeta = "project_metadata" // ResourceTypeRepository defines repository type. ResourceTypeRepository = "repository" // ResourceTypeManifest defines manifest type. ResourceTypeManifest = "manifest" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseManager ¶
type BaseManager struct {
// contains filtered or unexported fields
}
BaseManager is the base manager for cache and implement the cache manager interface.
func NewBaseManager ¶
func NewBaseManager(resourceType string) *BaseManager
NewBaseManager returns a instance of base manager.
func (*BaseManager) CacheClient ¶
func (bm *BaseManager) CacheClient(_ context.Context) cache.Cache
CacheClient returns the cache client.
func (*BaseManager) CountCache ¶
func (bm *BaseManager) CountCache(ctx context.Context) (int64, error)
CountCache returns current this resource occupied cache count.
func (*BaseManager) DeleteCache ¶
func (bm *BaseManager) DeleteCache(ctx context.Context, key string) error
DeleteCache deletes specific cache by key.
func (*BaseManager) FlushAll ¶
func (bm *BaseManager) FlushAll(ctx context.Context) error
FlushAll flush this resource's all cache.
func (*BaseManager) ResourceType ¶
func (bm *BaseManager) ResourceType(_ context.Context) string
ResourceType returns the resource type.
func (*BaseManager) WithCacheClient ¶
func (bm *BaseManager) WithCacheClient(cc cache.Cache) *BaseManager
WithCacheClient can override the default cache client.
type Manager ¶
type Manager interface { // CacheClient returns the cache client. CacheClient(ctx context.Context) cache.Cache // ResourceType returns the resource type. // eg. artifact、project、tag、repository ResourceType(ctx context.Context) string // CountCache returns current this resource occupied cache count. CountCache(ctx context.Context) (int64, error) // DeleteCache deletes specific cache by key. DeleteCache(ctx context.Context, key string) error // FlushAll flush this resource's all cache. FlushAll(ctx context.Context) error }
Manager is the interface for resource cache manager. Provides common interfaces for admin to view and manage resource cache.
type ObjectKey ¶
type ObjectKey struct {
// contains filtered or unexported fields
}
ObjectKey normalizes cache object key.
func NewObjectKey ¶
NewObjectKey returns object key with namespace.
Click to show internal directories.
Click to hide internal directories.