curios to know more on this - what you could do better using Lua logic?
curios to know more on this - what you could do better using Lua logic?
When the next HTTP request comes in to view that object, I lookup the object's date in the shared dict. If the modified date is > now(), I set the bypass flag to 1, so nginx updates its cache.
From docs:
Parameters of caching can also be set directly in the response header. This has higher priority than setting of caching time using the directive.
The “X-Accel-Expires” header field sets caching time of a response in seconds. The zero value disables caching for a response. If the value starts with the @ prefix, it sets an absolute time in seconds since Epoch, up to which the response may be cached.
If the header does not include the “X-Accel-Expires” field, parameters of caching may be set in the header fields “Expires” or “Cache-Control”.You can figure out where the item is in the nginx cache directory and delete it. But that is complicated by the fact that your app and nginx run as different users. Or you can send a specially crafted HTTP request to nginx assuming you have some kind of backdoor proxy_cache_bypass setup. But that's ugly too. You either have a race condition, or you have to hang your app's response until the invalidation request completes.
If there's another way to evict an item from the cache, I'm all ears.
> When the next HTTP request comes in to view that object, I lookup the object's date in the shared dict. If the modified date is > now(), I set the bypass flag to 1, so nginx updates its cache.
I see it exact as stock behavior and asking what the difference Lua logic brings here.