cache

package
v0.0.0-...-298dde5 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// WriteBack allows staging and write back of cached content for single object uploads
	WriteBack = "writeback"
	// WriteThrough allows caching multipart uploads to disk synchronously
	WriteThrough = "writethrough"
)
View Source
const (
	Drives        = "drives"
	Exclude       = "exclude"
	Expiry        = "expiry"
	MaxUse        = "maxuse"
	Quota         = "quota"
	After         = "after"
	WatermarkLow  = "watermark_low"
	WatermarkHigh = "watermark_high"
	Range         = "range"
	Commit        = "commit"

	EnvCacheDrives        = "MINIO_CACHE_DRIVES"
	EnvCacheExclude       = "MINIO_CACHE_EXCLUDE"
	EnvCacheExpiry        = "MINIO_CACHE_EXPIRY"
	EnvCacheMaxUse        = "MINIO_CACHE_MAXUSE"
	EnvCacheQuota         = "MINIO_CACHE_QUOTA"
	EnvCacheAfter         = "MINIO_CACHE_AFTER"
	EnvCacheWatermarkLow  = "MINIO_CACHE_WATERMARK_LOW"
	EnvCacheWatermarkHigh = "MINIO_CACHE_WATERMARK_HIGH"
	EnvCacheRange         = "MINIO_CACHE_RANGE"
	EnvCacheCommit        = "MINIO_CACHE_COMMIT"

	EnvCacheEncryptionKey = "MINIO_CACHE_ENCRYPTION_SECRET_KEY"

	DefaultExpiry        = "90"
	DefaultQuota         = "80"
	DefaultAfter         = "0"
	DefaultWaterMarkLow  = "70"
	DefaultWaterMarkHigh = "80"
)

Cache ENVs

Variables

View Source
var (
	DefaultKVS = config.KVS{
		config.KV{
			Key:   Drives,
			Value: "",
		},
		config.KV{
			Key:   Exclude,
			Value: "",
		},
		config.KV{
			Key:   Expiry,
			Value: DefaultExpiry,
		},
		config.KV{
			Key:   Quota,
			Value: DefaultQuota,
		},
		config.KV{
			Key:   After,
			Value: DefaultAfter,
		},
		config.KV{
			Key:   WatermarkLow,
			Value: DefaultWaterMarkLow,
		},
		config.KV{
			Key:   WatermarkHigh,
			Value: DefaultWaterMarkHigh,
		},
		config.KV{
			Key:   Range,
			Value: config.EnableOn,
		},
		config.KV{
			Key:   Commit,
			Value: "",
		},
	}
)

DefaultKVS - default KV settings for caching.

View Source
var (
	Help = config.HelpKVS{
		config.HelpKV{
			Key:         Drives,
			Description: `comma separated mountpoints e.g. "/optane1,/optane2"` + defaultHelpPostfix(Drives),
			Type:        "csv",
		},
		config.HelpKV{
			Key:         Expiry,
			Description: `cache expiry duration in days` + defaultHelpPostfix(Expiry),
			Optional:    true,
			Type:        "number",
		},
		config.HelpKV{
			Key:         Quota,
			Description: `limit cache drive usage in percentage` + defaultHelpPostfix(Quota),
			Optional:    true,
			Type:        "number",
		},
		config.HelpKV{
			Key:         Exclude,
			Description: `exclude cache for following patterns e.g. "bucket/*.tmp,*.exe"` + defaultHelpPostfix(Exclude),
			Optional:    true,
			Type:        "csv",
		},
		config.HelpKV{
			Key:         After,
			Description: `minimum number of access before caching an object` + defaultHelpPostfix(After),
			Optional:    true,
			Type:        "number",
		},
		config.HelpKV{
			Key:         WatermarkLow,
			Description: `% of cache use at which to stop cache eviction` + defaultHelpPostfix(WatermarkLow),
			Optional:    true,
			Type:        "number",
		},
		config.HelpKV{
			Key:         WatermarkHigh,
			Description: `% of cache use at which to start cache eviction` + defaultHelpPostfix(WatermarkHigh),
			Optional:    true,
			Type:        "number",
		},
		config.HelpKV{
			Key:         Range,
			Description: `set to "on" or "off" caching of independent range requests per object` + defaultHelpPostfix(Range),
			Optional:    true,
			Type:        "string",
		},
		config.HelpKV{
			Key:         Commit,
			Description: `set to control cache commit behavior` + defaultHelpPostfix(Commit),
			Optional:    true,
			Type:        "string",
		},
		config.HelpKV{
			Key:         config.Comment,
			Description: config.DefaultComment,
			Optional:    true,
			Type:        "sentence",
		},
	}
)

Help template for caching feature.

Functions

func Enabled

func Enabled(kvs config.KVS) bool

Enabled returns if cache is enabled.

func SetCacheConfig

func SetCacheConfig(s config.Config, cfg Config)

SetCacheConfig - One time migration code needed, for migrating from older config to new for Cache.

Types

type Config

type Config struct {
	Enabled         bool     `json:"-"`
	Drives          []string `json:"drives"`
	Expiry          int      `json:"expiry"`
	MaxUse          int      `json:"maxuse"`
	Quota           int      `json:"quota"`
	Exclude         []string `json:"exclude"`
	After           int      `json:"after"`
	WatermarkLow    int      `json:"watermark_low"`
	WatermarkHigh   int      `json:"watermark_high"`
	Range           bool     `json:"range"`
	CacheCommitMode string   `json:"commit"`
}

Config represents cache config settings

func LookupConfig

func LookupConfig(kvs config.KVS) (Config, error)

LookupConfig - extracts cache configuration provided by environment variables and merge them with provided CacheConfiguration.

func (*Config) UnmarshalJSON

func (cfg *Config) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON - implements JSON unmarshal interface for unmarshalling json entries for CacheConfig.

Jump to

Keyboard shortcuts

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