How to Guides
Lazy Load Configuration
Often when working with a programmable gateway like Zuplo you'll want to load some configuration and store it safely for fast access on future requests without impacting latency.
The fastest place to store such information is in memory, but there can be thousands of processes on Zuplo when you're at scale and sometimes those processes are not long lived.
The next fastest place is in ZoneCache which is a cache located in each datacenter. This requires an async connection but is usually much faster than going back to your configuration data store (often in a single location worldwide).
The MemoryZoneReadthroughCache offers the best of both worlds - it uses memory and zone cache in combination to afford the lowest possible latency.
Caution
Do take care not to load so much data into memory that you OOM (out-of-memory) your process. Processes in Zuplo typically have ~120MB of memory to perform all their work, including holding request bodies etc.
Here's a simple example of the usage of MemoryZoneReadthroughCache being used to store configuration data.