Integrated Caching
Varnish as the First Layer
Varnish runs in front of the content retriever (which fetches content from the Hosting Layer).
It checks if the requested CID is already cached before forwarding the request.
Cache Storage in Varnish
Varnish stores:
Static files (HTML, CSS, JS, images, videos)
Pre-fetched content for fast loading
Frequently accessed website CIDs
Step-by-Step Caching Process:
A. User Requests Content (example.com)
The request reaches Varnish (
gateway1.com
).Varnish checks its cache memory for the CID.
B. Cache Hit (Content Found in Varnish)
If the content exists in cache, it is immediately served from RAM.
Response time: <1ms (instant page load).
C. Cache Miss (Content Not in Varnish)
Varnish forwards the request to the Webhash Gateway Backend.
The Gateway Backend queries the Hosting Layer for the CID.
If content is found, it is stored in Varnish and then served to the user.
Varnish Cache Configuration for Webhash
The Varnish Configuration Language (VCL) is used to control caching behavior.
Explanation of Varnish Cache Rules
Caches content for 1 hour to improve performance.
Requests are forwarded to Hosting Layer only if necessary.
Responses are tagged with X-Cache (HIT/MISS) for debugging.
Cache Purging for New Website Updates
When a new CID is published, gateways can invalidate the cache for a specific website.
Last updated