HTTP Caching Proxy & CDN Edge Node

Cache and accelerate content delivery with intelligent purging, on-the-fly compression, image optimization, and edge computing capabilities. Written in Koder Lang.

v1.0.0
20+
.kd Source Files
6
Cache Strategies
4
Compression Algorithms
3
Load Balancers

Features

Tiered Caching

Memory (hot) and disk (warm) storage tiers with LRU, LFU, and ARC eviction policies. Automatic promotion from disk to memory on access.

🗝

Intelligent Purging

Purge by URL, wildcard pattern, cache tag, or regex ban. Soft purge marks content stale without removing it. Batch purge for bulk operations.

📦

On-the-fly Compression

Transparent gzip, Brotli, and Zstandard compression with Accept-Encoding negotiation. Compressible content types auto-detected.

📷

Image Optimization

Resize, quality adjustment, and automatic WebP/AVIF conversion. Query parameter API for on-demand transformations.

Edge Functions

Run Koder Lang snippets at the edge with sandboxed execution. Transform requests and responses with custom logic.

📐

VCL-like Rules

Varnish-inspired configuration with recv, hash, hit, miss, deliver, and synth phases. Full request/response control.

📈

Real-time Analytics

Hit ratio, bandwidth savings, latency percentiles (P50/P95/P99), top URLs, and status code distribution with Prometheus export.

🔒

Grace Mode

Serve stale content when origin is down. Supports stale-while-revalidate and stale-if-error Cache-Control directives.

🌐

Request Coalescing

Deduplicate concurrent requests for the same resource. Only one request goes to origin; all others wait for and share the result.

Architecture

Client → [TLS Termination] → [Edge Functions] → [Rules Engine] → [Cache Lookup] ↓ [HIT] → [Compress] → [Deliver] [MISS] → [Coalesce] → [Origin Pool] → [Store] → [Deliver]

CLI Usage

# Start the edge proxy kedge serve # Purge a URL kedge purge https://example.com/page # Purge by tag kedge purge --tag products # Add a ban pattern kedge ban ".*\\.jpg$" # Warm cache from file kedge warm --file urls.txt # View real-time stats kedge stats # Check health kedge health