loki cache_config

The cache block configures the cache backend. The supported CLI flags <prefix> used to reference this configuration block are:

  • frontend

  • frontend.index-stats-results-cache

  • store.chunks-cache

  • store.index-cache-read

  • store.index-cache-write

    (deprecated: use embedded-cache instead) Enable in-memory cache (auto-enabled

    for the chunks & query results cache if no other cache is configured).

    CLI flag: -<prefix>.cache.enable-fifocache

    [enable_fifocache: <boolean> | default = false]

    The default validity of entries for caches unless overridden.

    CLI flag: -<prefix>.default-validity

    [default_validity: <duration> | default = 1h]

    background:
    # At what concurrency to write back to cache.
    # CLI flag: -<prefix>.background.write-back-concurrency
    [writeback_goroutines: <int> | default = 10]

    复制代码
    # How many key batches to buffer for background write-back.
    # CLI flag: -<prefix>.background.write-back-buffer
    [writeback_buffer: <int> | default = 10000]
    
    # Size limit in bytes for background write-back.
    # CLI flag: -<prefix>.background.write-back-size-limit
    [writeback_size_limit: <int> | default = 1GB]

    memcached:
    # How long keys stay in the memcache.
    # CLI flag: -<prefix>.memcached.expiration
    [expiration: <duration> | default = 0s]

    复制代码
    # How many keys to fetch in each batch.
    # CLI flag: -<prefix>.memcached.batchsize
    [batch_size: <int> | default = 1024]
    
    # Maximum active requests to memcache.
    # CLI flag: -<prefix>.memcached.parallelism
    [parallelism: <int> | default = 100]

    memcached_client:
    # Hostname for memcached service to use. If empty and if addresses is unset,
    # no memcached will be used.
    # CLI flag: -<prefix>.memcached.hostname
    [host: <string> | default = ""]

    复制代码
    # SRV service used to discover memcache servers.
    # CLI flag: -<prefix>.memcached.service
    [service: <string> | default = "memcached"]
    
    # EXPERIMENTAL: Comma separated addresses list in DNS Service Discovery
    # format:
    # https://cortexmetrics.io/docs/configuration/arguments/#dns-service-discovery
    # CLI flag: -<prefix>.memcached.addresses
    [addresses: <string> | default = ""]
    
    # Maximum time to wait before giving up on memcached requests.
    # CLI flag: -<prefix>.memcached.timeout
    [timeout: <duration> | default = 100ms]
    
    # Maximum number of idle connections in pool.
    # CLI flag: -<prefix>.memcached.max-idle-conns
    [max_idle_conns: <int> | default = 16]
    
    # The maximum size of an item stored in memcached. Bigger items are not
    # stored. If set to 0, no maximum size is enforced.
    # CLI flag: -<prefix>.memcached.max-item-size
    [max_item_size: <int> | default = 0]
    
    # Period with which to poll DNS for memcache servers.
    # CLI flag: -<prefix>.memcached.update-interval
    [update_interval: <duration> | default = 1m]
    
    # Use consistent hashing to distribute to memcache servers.
    # CLI flag: -<prefix>.memcached.consistent-hash
    [consistent_hash: <boolean> | default = true]
    
    # Trip circuit-breaker after this number of consecutive dial failures (if zero
    # then circuit-breaker is disabled).
    # CLI flag: -<prefix>.memcached.circuit-breaker-consecutive-failures
    [circuit_breaker_consecutive_failures: <int> | default = 10]
    
    # Duration circuit-breaker remains open after tripping (if zero then 60
    # seconds is used).
    # CLI flag: -<prefix>.memcached.circuit-breaker-timeout
    [circuit_breaker_timeout: <duration> | default = 10s]
    
    # Reset circuit-breaker counts after this long (if zero then never reset).
    # CLI flag: -<prefix>.memcached.circuit-breaker-interval
    [circuit_breaker_interval: <duration> | default = 10s]

    redis:
    # Redis Server or Cluster configuration endpoint to use for caching. A
    # comma-separated list of endpoints for Redis Cluster or Redis Sentinel. If
    # empty, no redis will be used.
    # CLI flag: -<prefix>.redis.endpoint
    [endpoint: <string> | default = ""]

    复制代码
    # Redis Sentinel master name. An empty string for Redis Server or Redis
    # Cluster.
    # CLI flag: -<prefix>.redis.master-name
    [master_name: <string> | default = ""]
    
    # Maximum time to wait before giving up on redis requests.
    # CLI flag: -<prefix>.redis.timeout
    [timeout: <duration> | default = 500ms]
    
    # How long keys stay in the redis.
    # CLI flag: -<prefix>.redis.expiration
    [expiration: <duration> | default = 0s]
    
    # Database index.
    # CLI flag: -<prefix>.redis.db
    [db: <int> | default = 0]
    
    # Maximum number of connections in the pool.
    # CLI flag: -<prefix>.redis.pool-size
    [pool_size: <int> | default = 0]
    
    # Username to use when connecting to redis.
    # CLI flag: -<prefix>.redis.username
    [username: <string> | default = ""]
    
    # Password to use when connecting to redis.
    # CLI flag: -<prefix>.redis.password
    [password: <string> | default = ""]
    
    # Enable connecting to redis with TLS.
    # CLI flag: -<prefix>.redis.tls-enabled
    [tls_enabled: <boolean> | default = false]
    
    # Skip validating server certificate.
    # CLI flag: -<prefix>.redis.tls-insecure-skip-verify
    [tls_insecure_skip_verify: <boolean> | default = false]
    
    # Close connections after remaining idle for this duration. If the value is
    # zero, then idle connections are not closed.
    # CLI flag: -<prefix>.redis.idle-timeout
    [idle_timeout: <duration> | default = 0s]
    
    # Close connections older than this duration. If the value is zero, then the
    # pool does not close connections based on age.
    # CLI flag: -<prefix>.redis.max-connection-age
    [max_connection_age: <duration> | default = 0s]
    
    # By default, the Redis client only reads from the master node. Enabling this
    # option can lower pressure on the master node by randomly routing read-only
    # commands to the master and any available replicas.
    # CLI flag: -<prefix>.redis.route-randomly
    [route_randomly: <boolean> | default = false]

    embedded_cache:
    # Whether embedded cache is enabled.
    # CLI flag: -<prefix>.embedded-cache.enabled
    [enabled: <boolean> | default = false]

    复制代码
    # Maximum memory size of the cache in MB.
    # CLI flag: -<prefix>.embedded-cache.max-size-mb
    [max_size_mb: <int> | default = 100]
    
    # The time to live for items in the cache before they get purged.
    # CLI flag: -<prefix>.embedded-cache.ttl
    [ttl: <duration> | default = 1h]

    fifocache:
    # Maximum memory size of the cache in bytes. A unit suffix (KB, MB, GB) may be
    # applied.
    # CLI flag: -<prefix>.fifocache.max-size-bytes
    [max_size_bytes: <string> | default = "1GB"]

    复制代码
    # deprecated: Maximum number of entries in the cache.
    # CLI flag: -<prefix>.fifocache.max-size-items
    [max_size_items: <int> | default = 0]
    
    # The time to live for items in the cache before they get purged.
    # CLI flag: -<prefix>.fifocache.ttl
    [ttl: <duration> | default = 1h]
    
    # Deprecated (use ttl instead): The expiry duration for the cache.
    # CLI flag: -<prefix>.fifocache.duration
    [validity: <duration> | default = 0s]
    
    # Deprecated (use max-size-items or max-size-bytes instead): The number of
    # entries to cache.
    # CLI flag: -<prefix>.fifocache.size
    [size: <int> | default = 0]
    
    [purgeinterval: <duration>]

    The maximum number of concurrent asynchronous writeback cache can occur.

    CLI flag: -<prefix>.max-async-cache-write-back-concurrency

    [async_cache_write_back_concurrency: <int> | default = 16]

    The maximum number of enqueued asynchronous writeback cache allowed.

    CLI flag: -<prefix>.max-async-cache-write-back-buffer-size

    [async_cache_write_back_buffer_size: <int> | default = 500]

相关推荐
_r0bin_2 小时前
前端面试准备-7
开发语言·前端·javascript·fetch·跨域·class
IT瘾君2 小时前
JavaWeb:前端工程化-Vue
前端·javascript·vue.js
potender2 小时前
前端框架Vue
前端·vue.js·前端框架
站在风口的猪11083 小时前
《前端面试题:CSS预处理器(Sass、Less等)》
前端·css·html·less·css3·sass·html5
程序员的世界你不懂3 小时前
(9)-Fiddler抓包-Fiddler如何设置捕获Https会话
前端·https·fiddler
MoFe13 小时前
【.net core】天地图坐标转换为高德地图坐标(WGS84 坐标转 GCJ02 坐标)
java·前端·.netcore
去旅行、在路上4 小时前
chrome使用手机调试触屏web
前端·chrome
Aphasia3114 小时前
模式验证库——zod
前端·react.js
lexiangqicheng5 小时前
es6+和css3新增的特性有哪些
前端·es6·css3
拉不动的猪6 小时前
都25年啦,还有谁分不清双向绑定原理,响应式原理、v-model实现原理
前端·javascript·vue.js