Small feature request for memcached module

I would really like to be able to to :
“set $memcached_key_sha1 $request_uri;”

And the then module should lookup using the hashed key instead of
“$memcached_key”.
I guess this would be a minute hack for anyone that has some knowledge
of the inner working of nginx :wink:

Jay E. wrote:

I would really like to be able to to :
“set $memcached_key_sha1 $request_uri;”

And the then module should lookup using the hashed key instead of
“$memcached_key”.
I guess this would be a minute hack for anyone that has some knowledge
of the inner working of nginx :wink:
Or implementing a set_sha1 and set_md5 that sets a variable using the
hashed value instead of the direct one.
If i don’t get any response for this i will try to implement it myself
because this cant be really that complicated and i guess that it would
be a neat thing to have in many ways.

Jay E. wrote:

I would really like to be able to to :
“set $memcached_key_sha1 $request_uri;”

And the then module should lookup using the hashed key instead of
“$memcached_key”.
I guess this would be a minute hack for anyone that has some knowledge
of the inner working of nginx :wink:

Hi Jay,

Unless I’ve missed something, this appears to give no benefit, at a cost
of extra computation.

What were you hoping to achieve?

Regards

Ian

Ian H. wrote:

Hi Jay,

Unless I’ve missed something, this appears to give no benefit, at a
cost of extra computation.

What were you hoping to achieve?
As memcached (or the module implementation?) does not like some
characters in the key some request_uri fails.
I am implementing a “live search” that uses AJAX and first hits nginx
and sees if the requested data is memcached and then failbacks to apache
and PHP that then sets the the data in memcache.

On Fri, Dec 18, 2009 at 12:07 AM, Jay E. [email protected] wrote:

And the then module should lookup using the hashed key instead of
“$memcached_key”.
I guess this would be a minute hack for anyone that has some knowledge of
the inner working of nginx :wink:

Oh, it’s been a TODO for my ngx_echo module :wink: But I’ve been busy with
bug fixes in the ngx_chunkin module atm :stuck_out_tongue:

Cheers,
-agentzh

Jay E. wrote:

If i don’t get any response for this i will try to implement it myself
because this cant be really that complicated and i guess that it would
be a neat thing to have in many ways.

A very friendly member of this list has implemented the above and i am
currently testing it and so far it works as it should. I guess he will
announce the module when it is ready for release.

On Sat, Dec 19, 2009 at 3:56 PM, agentzh [email protected] wrote:

Oh, it’s been a TODO for my ngx_echo module :wink: But I’ve been busy with
bug fixes in the ngx_chunkin module atm :stuck_out_tongue:

BTW, “set $memcached_key blah blah” is not a ngx_memcached magic, but
rather ngx_rewrite. I think this feature is general enough to be
included in a separate module. Also, we could get URI escaping and
unescaping routines for any nginx variables like this:

set_uri_unescape $memcached_key $arg_my_key;

as well as

set_sha1 $memcached_key $request_uri

set_md5 $memcached_key $request_uri

in your situation :wink:

Well, a module named ngx_escape or ngx_var_filter now comes into my mind
:wink:

Cheers,
-agentzh