Class CacheConfiguration
- Namespace
- CL.MySQL2.Configuration
- Assembly
- CL.MySQL2.dll
Process-wide cache configuration for CL.MySQL2. Applies to all databases unless a per-database override is set on CacheEnabledOverride.
[ConfigSection("mysql.cache")]
public sealed class CacheConfiguration : ConfigModelBase
- Inheritance
-
ConfigModelBaseCacheConfiguration
- Inherited Members
-
ConfigModelBase.Validate()
Properties
DefaultTtlSeconds
Default TTL used when WithCache() is called without arguments.
[ConfigField(Label = "Default TTL (seconds)", Min = 1, Description = "Default cache lifetime when .WithCache() has no TTL argument.", Group = "Behavior", Order = 20)]
public int DefaultTtlSeconds { get; set; }
Property Value
Enabled
Master switch for the query result cache.
[ConfigField(Label = "Enabled", Description = "Turn the query result cache on or off globally.", Group = "General", Order = 0)]
public bool Enabled { get; set; }
Property Value
MaxEntries
Maximum number of cached entries across all databases.
[ConfigField(Label = "Max Entries", Min = 0, Description = "Total cached entries. Soft cap enforced lazily.", Group = "Capacity", Order = 10)]
public int MaxEntries { get; set; }
Property Value
MaxMemoryMb
Soft memory cap for the cache in megabytes. Currently advisory — eviction uses entry count; memory accounting lands in a follow-up.
[ConfigField(Label = "Max Memory (MB)", Min = 0, Description = "Soft memory cap. Advisory; current eviction uses entry count.", Group = "Capacity", Order = 11, Collapsed = true)]
public int MaxMemoryMb { get; set; }
Property Value
PublishEvents
Whether the cache publishes hit/miss events on the event bus.
[ConfigField(Label = "Publish Cache Events", Description = "Emit CacheHitEvent / CacheMissEvent for observability.", Group = "Observability", Order = 30)]
public bool PublishEvents { get; set; }
Property Value
TimeQuantizeSeconds
Time-near-now closure values used as query parameters (e.g.
DateTime.UtcNow.AddDays(-30)) are rounded down to this window when
forming the cache key. Without this, every call produces a unique cache key
and nothing ever hits. Set to 0 to disable and use raw timestamps.
[ConfigField(Label = "Time Quantize (seconds)", Min = 0, Description = "Round DateTime parameters to this window when building cache keys. 0 disables.", Group = "Behavior", Order = 21)]
public int TimeQuantizeSeconds { get; set; }