Hi,
I'm working on a simple cache-manager module - [1] to make it easier to manage a multi-layered cache data store using a simple interface:
my_cache:get(key)
my_cache:put(key,value)
my_cache can be configured with multiple data stores such as Redis and shared_dict; a put method would save the key,value pair in both stores, and a get operation would lookup the key first in the shared_dict and then if it's not there it would lookup the key in Redis, then it would save the returned value from Redis into the shared_dict for the next time get is invoked.
This module works OOTB with the srcache module but in my tests I'm not able to test the scenario when the file is buffered to disk and the lua code needs to invoke ngx.req.get_body_file()
I've been trying to define the subrequest with client_body_in_file_only on; but in the logs I keep seeing:
[debug] 17#0: *1 lua start to read buffered request body
[debug] 17#0: *1 lua req body post read, c:3
[debug] 17#0: *1 lua has read buffered request body in a single run
Even though NGINX is buffering the response to disk:
[warn] 17#0: *1 an upstream response is buffered to a temporary file /usr/local/api-gateway/proxy_temp/1/00/0000000001 while reading upstream, client: 192.168.75.1, server: , request: "GET /cache/img_test.JPG HTTP/1.1", upstream: "http://127.0.0.1:80/html/img_test.JPG", host: "192.168.75.158"
Content-Length: 2858221
Should we conclude that subrequests and/or srcache would always read the content from the memory regardless of what NGINX does ? If not, how should I write a test for this use case ? Is there a setting I could use to force lua to read from the file ?
Thanks,
dragos dascalita haut
[1] - https://github.com/adobe-apiplatform/api-gateway-cachemanager