Session cache

Hi, could anybody say, may i cache dynamic content for sessions isolate
from eache other ?
I have very hard sql, but it is show some results which very variative
for
users, but some times users call this script many time in small period
of
time, so i wana cache the results in small period for each
users-session.
Is it possible in nginx.
Nginx work as proxy_pass http://application_server
And cache some static for spesific locations.

On Mon, Dec 02, 2013 at 03:47:42PM +0300, Дмитрий Лабазнов wrote:

Hi there,

Hi, could anybody say, may i cache dynamic content for sessions isolate
from eache other ?

http://nginx.org/r/proxy_cache_key

Include something unique per session in the key.

f

Francis D. [email protected]

Could you plz some example ?

2013/12/2 Francis D. [email protected]

Hi there,

Could you plz some example ?

What is a session?

If it is a cookie called “user”, then something like

proxy_cache_key “$host$request_uri $cookie_user”;

may work for you.
yes cookie, what does it mean called “user” ?
Users have a cookie session, and this strind do not work =(

On Mon, Dec 02, 2013 at 09:18:06PM +0400, Дмитрий Лабазнов wrote:

Hi there,

Could you plz some example ?

What is a session?

If it is a cookie called “user”, then something like

proxy_cache_key “$host$request_uri $cookie_user”;

may work for you.

f

Francis D. [email protected]

— Original message —
From: “Francis D.” [email protected]
Date: 2 December 2013, 19:21:29

proxy_cache_key “$host$request_uri $cookie_user”;
Or better: proxy_cache_key “$host$request_uri$cookie_user$remote_addr”;

On Mon, Dec 02, 2013 at 09:29:53PM +0400, Дмитрий Лабазнов wrote:

Hi there,

If it is a cookie called “user”, then something like

proxy_cache_key “$host$request_uri $cookie_user”;

yes cookie, what does it mean called “user” ?
Users have a cookie session, and this strind do not work =(

http://nginx.org/en/docs/http/ngx_http_core_module.html#variables

or maybe

http://nginx.org/ru/docs/http/ngx_http_core_module.html#variables

If the cookie name is “session”, then the nginx variable is
$cookie_session.

f

Francis D. [email protected]

On Mon, Dec 02, 2013 at 09:29:53PM +0400, wrote:

Hi there,

If it is a cookie called “user”, then something like

proxy_cache_key “$host$request_uri $cookie_user”;

yes cookie, what does it mean called “user” ?
Users have a cookie session, and this strind do not work =(

http://nginx.org/en/docs/http/ngx_http_core_module.html#variables

or maybe

http://nginx.org/ru/docs/http/ngx_http_core_module.html#variables

If the cookie name is “session”, then the nginx variable is
$cookie_session.

THX!!! Its work!
location ~* ^/.+.(php)$ {
proxy_cache_methods GET HEAD POST;
proxy_ignore_headers Cache-Control Expires;
proxy_cache_key “$host$request_uri $cookie_PHPSESSID”;
proxy_pass http://localhost:8080;
proxy_temp_path /tmp/nginx/tmp;
proxy_cache one;
proxy_cache_valid 200 304 1m;
expires 1m;
}
here i cache all php dynavics, cous it is from test stand. But it is
work,
dynamic for various browsers cached
in conformity with they cookies. Thx a lot!
It is strange, this easy example i couldnt google for my case and
situation.

2013/12/2 Francis D. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs