QuickDID is a high-performance AT Protocol identity resolution service written in Rust. It provides handle-to-DID resolution with Redis-backed caching and queue processing.
···550550551551## HTTP Caching Configuration
552552553553+### `CACHE_MAX_AGE`
554554+555555+**Required**: No
556556+**Type**: Integer (seconds)
557557+**Default**: `86400` (24 hours)
558558+**Range**: 0-31536000 (0 to 1 year)
559559+560560+Maximum age for HTTP Cache-Control header in seconds. When set to 0, the Cache-Control header is disabled and will not be added to responses. This controls how long clients and intermediate caches can cache responses.
561561+562562+**Examples**:
563563+```bash
564564+# Default (24 hours)
565565+CACHE_MAX_AGE=86400
566566+567567+# Aggressive caching (7 days)
568568+CACHE_MAX_AGE=604800
569569+570570+# Conservative caching (1 hour)
571571+CACHE_MAX_AGE=3600
572572+573573+# Disable Cache-Control header
574574+CACHE_MAX_AGE=0
575575+```
576576+577577+### `CACHE_STALE_IF_ERROR`
578578+579579+**Required**: No
580580+**Type**: Integer (seconds)
581581+**Default**: `172800` (48 hours)
582582+583583+Allows stale content to be served if the backend encounters an error. This provides resilience during service outages.
584584+585585+**Examples**:
586586+```bash
587587+# Default (48 hours)
588588+CACHE_STALE_IF_ERROR=172800
589589+590590+# Extended error tolerance (7 days)
591591+CACHE_STALE_IF_ERROR=604800
592592+593593+# Minimal error tolerance (1 hour)
594594+CACHE_STALE_IF_ERROR=3600
595595+```
596596+597597+### `CACHE_STALE_WHILE_REVALIDATE`
598598+599599+**Required**: No
600600+**Type**: Integer (seconds)
601601+**Default**: `86400` (24 hours)
602602+603603+Allows stale content to be served while fresh content is being fetched in the background. This improves perceived performance.
604604+605605+**Examples**:
606606+```bash
607607+# Default (24 hours)
608608+CACHE_STALE_WHILE_REVALIDATE=86400
609609+610610+# Quick revalidation (1 hour)
611611+CACHE_STALE_WHILE_REVALIDATE=3600
612612+613613+# Extended revalidation (7 days)
614614+CACHE_STALE_WHILE_REVALIDATE=604800
615615+```
616616+617617+### `CACHE_MAX_STALE`
618618+619619+**Required**: No
620620+**Type**: Integer (seconds)
621621+**Default**: `172800` (48 hours)
622622+623623+Maximum time a client will accept stale responses. This provides an upper bound on how old cached content can be.
624624+625625+**Examples**:
626626+```bash
627627+# Default (48 hours)
628628+CACHE_MAX_STALE=172800
629629+630630+# Extended staleness (7 days)
631631+CACHE_MAX_STALE=604800
632632+633633+# Strict freshness (1 hour)
634634+CACHE_MAX_STALE=3600
635635+```
636636+637637+### `CACHE_MIN_FRESH`
638638+639639+**Required**: No
640640+**Type**: Integer (seconds)
641641+**Default**: `3600` (1 hour)
642642+643643+Minimum time a response must remain fresh. Clients will not accept responses that will expire within this time.
644644+645645+**Examples**:
646646+```bash
647647+# Default (1 hour)
648648+CACHE_MIN_FRESH=3600
649649+650650+# Strict freshness (24 hours)
651651+CACHE_MIN_FRESH=86400
652652+653653+# Relaxed freshness (5 minutes)
654654+CACHE_MIN_FRESH=300
655655+```
656656+657657+**Cache-Control Header Format**:
658658+659659+When `CACHE_MAX_AGE` is greater than 0, the following Cache-Control header is added to responses:
660660+```
661661+Cache-Control: public, max-age=86400, stale-while-revalidate=86400, stale-if-error=172800, max-stale=172800, min-fresh=3600
662662+```
663663+664664+**Recommendations**:
665665+- **High-traffic services**: Use longer max-age (86400-604800) to reduce load
666666+- **Frequently changing data**: Use shorter max-age (3600-14400)
667667+- **Critical services**: Set higher stale-if-error for resilience
668668+- **Performance-sensitive**: Enable stale-while-revalidate for better UX
669669+- **Disable caching**: Set CACHE_MAX_AGE=0 for real-time data
670670+553671### `ETAG_SEED`
554672555673**Required**: No
···633751RESOLVER_MAX_CONCURRENT=100
634752RESOLVER_MAX_CONCURRENT_TIMEOUT_MS=5000 # 5 second timeout
635753754754+# HTTP Caching (Cache-Control headers)
755755+CACHE_MAX_AGE=86400 # 24 hours
756756+CACHE_STALE_IF_ERROR=172800 # 48 hours
757757+CACHE_STALE_WHILE_REVALIDATE=86400 # 24 hours
758758+636759# Logging
637760RUST_LOG=info
638761```
···662785# Rate Limiting (optional, recommended for production)
663786RESOLVER_MAX_CONCURRENT=100
664787RESOLVER_MAX_CONCURRENT_TIMEOUT_MS=5000 # 5 second timeout
788788+789789+# HTTP Caching (Cache-Control headers)
790790+CACHE_MAX_AGE=86400 # 24 hours
791791+CACHE_STALE_IF_ERROR=172800 # 48 hours
792792+CACHE_STALE_WHILE_REVALIDATE=86400 # 24 hours
665793666794# Logging
667795RUST_LOG=info
+25
docs/production-deployment.md
···213213# Default uses the application version from Cargo.toml
214214# ETAG_SEED=prod-2024-01-15
215215216216+# Maximum age for HTTP Cache-Control header in seconds (default: 86400 = 24 hours)
217217+# Set to 0 to disable Cache-Control header
218218+# Controls how long clients and intermediate caches can cache responses
219219+CACHE_MAX_AGE=86400
220220+221221+# Stale-if-error directive for Cache-Control in seconds (default: 172800 = 48 hours)
222222+# Allows stale content to be served if backend errors occur
223223+# Provides resilience during service outages
224224+CACHE_STALE_IF_ERROR=172800
225225+226226+# Stale-while-revalidate directive for Cache-Control in seconds (default: 86400 = 24 hours)
227227+# Allows stale content to be served while fetching fresh content in background
228228+# Improves perceived performance for users
229229+CACHE_STALE_WHILE_REVALIDATE=86400
230230+231231+# Max-stale directive for Cache-Control in seconds (default: 172800 = 48 hours)
232232+# Maximum time client will accept stale responses
233233+# Provides upper bound on cached content age
234234+CACHE_MAX_STALE=172800
235235+236236+# Min-fresh directive for Cache-Control in seconds (default: 3600 = 1 hour)
237237+# Minimum time response must remain fresh
238238+# Clients won't accept responses expiring within this time
239239+CACHE_MIN_FRESH=3600
240240+216241# ----------------------------------------------------------------------------
217242# PERFORMANCE TUNING
218243# ----------------------------------------------------------------------------