Variable memcached_key

Hello ou bonjour, je suis Français, donc google va m’aider ^^

I memcached installed on a production server.
With libmemcached I sent pictures in memory:

:/usr/local/nginx/conf# /usr/local/libmemcached/bin/memcp
/data/www/logos/logo.jpg --servers=127.0.0.1:11211

The file are available:

vigier:/usr/local/nginx/conf# /usr/local/libmemcached/bin/memstat
–servers=127.0.0.1
Listing 1 Server

Server: 127.0.0.1 (11211)
pid: 20197
uptime: 3109
time: 1216605555
version: 1.2.5
pointer_size: 32
rusage_user: 0.0
rusage_system: 0.8000
curr_items: 2
total_items: 2
bytes: 11724
curr_connections: 2
total_connections: 115
connection_structures: 5
cmd_get: 102
cmd_set: 2
get_hits: 42
get_misses: 60
evictions: 0
bytes_read: 11724
bytes_written: 11724
limit_maxbytes: 20971520
threads: 1

The problem was that the images are at the “root” in memory, So when I
put this:

location ~ .(gif|jpg|jpeg)$ {
set $memcached_key $args;
memcached_pass 127.0.0.1:11211;
}

I have this to log:

2008/07/21 04:03:11 [info] 21310#0: *6 key: “/logos/logo.jpg” was not
found by memcached while reading response header from upstream, client:
XXXXXXXXX, server: XXXXXX, request: “GET /logos/logo.jpg HTTP/1.1”,
upstream: “memcached://127.0.0.1:11211”, host: “XXXXXXX:85”, referrer:
http://XXXXXX:85/

2008/07/21 04:03:11 [info] 21310#0: *4 key: “/logos/logo21.jpg” was not
found by memcached while reading response header from upstream, client:
XXXXXX, server: XXXXXXXX, request: “GET /logos/logo21.jpg HTTP/1.1”,
upstream: “memcached://127.0.0.1:11211”, host: “XXXXXXX:85”, referrer:
http://XXXXXXXX:85/

And when I test by placing:

   set  $memcached_key logo.jpg;
   memcached_pass   127.0.0.1:11211;

This works well.

So my question, is there a variable for only the filename, or a trick to
get it back.

Thank you.

Guillaume.

Hello!

On Mon, Jul 21, 2008 at 04:09:58AM +0200, Arteta Arteta wrote:

Hello ou bonjour, je suis Fran??ais, donc google va m’aider ^^

I memcached installed on a production server.
With libmemcached I sent pictures in memory:

:/usr/local/nginx/conf# /usr/local/libmemcached/bin/memcp
/data/www/logos/logo.jpg --servers=127.0.0.1:11211

[…]

2008/07/21 04:03:11 [info] 21310#0: *6 key: “/logos/logo.jpg” was not

And when I test by placing:

  set  $memcached_key logo.jpg;
  memcached_pass   127.0.0.1:11211;

This works well.

So my question, is there a variable for only the filename, or a trick to
get it back.

 if ($uri ~= "([^/]+$)") {
     set $memcached_key $1;
 }
 memcached_pass ...;

See http://wiki.codemongers.com/NginxHttpRewriteModule for details
about ways to manipulate variables.

See http://wiki.codemongers.com/NginxHttpCoreModule for details
about available generic variables.

Maxim D.