Skip to main content

Caches

Cache resources provide key-value storage that components can use to persist state. They are created through the Qaynaq UI and linked to flows that need them.

Components like CDC MySQL and Shopify reference a cache by its label to store and retrieve data such as binlog positions or pagination cursors.

How caches work

Each cache resource has:

  • Label: A unique name used by components to reference this cache (e.g., positions).
  • Component: The cache type (e.g., memory, redis, file).
  • Config: Type-specific settings.

When a flow is linked to a cache resource, the cache becomes available to the flow's components at runtime. Components access the cache by label and store data under specific keys.

Multiple flows can share a single cache resource as long as they use different keys.


Memory

In-process in-memory cache. Fast but does not survive restarts. Good for development and testing.

FieldTypeDefaultDescription
Default TTLstring5mTTL for each item. After this period the item is eligible for removal on next compaction
Compaction Intervalstring60sHow often to compact and remove expired items. Set to empty string to disable
Init Valuesobject{}Key/value pairs to pre-populate the cache on initialization
Shardsinteger1Number of logical shards. Increasing shards can improve performance under high concurrency

Redis

Persistent, distributed cache backed by Redis. Recommended for production use with components that need to survive restarts (like CDC position tracking).

FieldTypeDefaultDescription
URLstring(required) Redis server URL. Database can be specified as URL path (e.g., redis://localhost:6379/1)
KindstringsimpleClient type: simple, cluster, or failover
MasterstringRedis master name (when Kind is failover)
PrefixstringKey prefix to prevent collisions with other services
Default TTLstringDefault TTL for items. Empty means no expiry

TLS settings:

FieldTypeDefaultDescription
EnabledbooleanfalseWhether custom TLS settings are enabled
Skip Cert VerifybooleanfalseWhether to skip server-side certificate verification
Enable RenegotiationbooleanfalseWhether to allow the remote server to repeatedly request renegotiation
Root CAsstringAn optional root certificate authority to use
Root CAs FilestringAn optional path of a root certificate authority file to use
Client Certsarray[]A list of client certificates to use

Retry settings:

FieldTypeDefaultDescription
Initial Intervalstring500msThe initial period to wait between retry attempts
Max Intervalstring1sThe maximum period to wait between retry attempts
Max Elapsed Timestring5sThe maximum overall period of time to spend on retry attempts before aborting

Memcached

Distributed cache backed by Memcached.

FieldTypeDefaultDescription
Addressesarray(required) List of Memcached server addresses
PrefixstringKey prefix to prevent collisions
Default TTLstring300sDefault TTL for items

Retry settings:

FieldTypeDefaultDescription
Initial Intervalstring1sThe initial period to wait between retry attempts
Max Intervalstring5sThe maximum period to wait between retry attempts
Max Elapsed Timestring30sThe maximum overall period of time to spend on retry attempts before aborting

File

File-system-based cache. Each key is stored as a file in the specified directory. Survives restarts but is local to the machine.

FieldTypeDefaultDescription
Directorystring(required) Directory to store cache files in

LRU

In-memory Least Recently Used cache with a fixed capacity. Does not survive restarts.

FieldTypeDefaultDescription
Capacityinteger1024(required) Maximum number of items
Init Valuesobject{}Key/value pairs to pre-populate the cache on initialization

TTLRU

In-memory LRU cache with per-item TTL expiry. Does not survive restarts.

FieldTypeDefaultDescription
Capacityinteger1024(required) Maximum number of items
Default TTLstring5mDefault TTL for items
Init Valuesobject{}Key/value pairs to pre-populate the cache on initialization

Ristretto

High-performance in-memory cache using the Ristretto library. Provides better hit ratios than simple LRU under many workloads. Does not survive restarts.

FieldTypeDefaultDescription
Default TTLstring5mDefault TTL for items
Max Costinteger1073741824The maximum size of the cache in bytes (default ~1 GB)
Num Countersinteger10000000The number of 4-bit access counters to keep for admission and eviction

Noop

A no-operation cache that discards all writes and returns not-found for all reads. Useful for testing or disabling caching without changing the pipeline structure.

No configuration fields.


Choosing a cache type

Use caseRecommended cache
Development / testingMemory
Production CDC position trackingRedis or File
Single-node deploymentFile
Multi-node / distributed deploymentRedis or Memcached
High-throughput state with evictionRistretto or TTLRU