Hi,
I can't store data while I'm using proxy_pass to connect to the backend if we can't find data on the memcached. srcache_fetch probes the memcached but since no data, it connect to the backend and get the correct data but not executing the srcache_store. Here is my config.
location /memc {
internal;
memc_connect_timeout 500ms; # 500 miliseconds
memc_send_timeout 5000ms; # 5 seconds
memc_read_timeout 500ms; # 500 miliseconds
set $memc_key $query_string;
set $memc_exptime 3600;
memc_pass 127.0.0.1:11211;
}
location /webservice {
set $key $http_host$request_uri;
srcache_fetch GET /memc $key;
add_header X-Cached-From srcache-memcached;
# store the content!
srcache_store_statuses 200 201 301 302 404 503 502;
srcache_store PUT /memc $key;
# if it is not found we go to the backend
proxy_pass http://remoteserver;
}
I use nginx-1.0.10. and I should be able to use proxy_pass to get backend data while store data on the cache..?
If I comment the proxy_pass, srcache_store triggered and stored the 502 status page as it can't connect to the backend.
Please help me on how to use srcache_store and use proxy_pass to store data and connect to backend.
Thanks in advance.