Memcached/JSONP

Marcus Clyne ngx.eugaia at gmail.com
Wed Dec 23 13:29:39 MSK 2009


Hi,

dylanz wrote:
> agentzh Wrote:
> -------------------------------------------------------
>   
>> On Wed, Dec 23, 2009 at 8:36 AM, dylanz  wrote:
>>     
>>> location /first {
>>>  echo "before";
>>>  echo_location_aysnc /second$request_uri;
>>>  echo "after"
>>> }
>>>
>>> location /second(.*)\?(.*)^ {
>>>  set $memcached_key $1;  # needing this to be
>>>       
>> keyed on the request_path, not the entire uri
>>     
>>>  memcached_pass 127.0.0.1;
>>> }
>>>
>>>       
>> Well, I think you should not assume the query
>> string part, i.e.,
>> "?xxx", can be specified in the location name :)
>> Try the following:
>>
>>   location /first {
>>     echo "before";
>>     echo_location_async /second $request_uri;
>>     echo "after";
>>   }
>>
>>   location = /second {
>>     set $memcached_key $query_string;
>>     memcached_pass 127.0.0.1;
>>   }
>>     
>
>
> Great point!  What you proposed is almost there, but, I don't want the $query_string, but simply the path.
> I've tried a few different combinations of location directives, but can't seem to get it right.  For example:
>
> If I made a request to:
> /first/11111.ext?callback=222222
>
> I'd want to look up the following path in Memcached:
> /first/11111.ext
>
> So, when I do that echo_async_location, I don't see how I'm able to extrapolate the path out.
> If there was an internal variable that held the $uri, minus the $query_string, that would do it!
> However, I don't think that exists at the moment.
>
>   
set   $memcached_key   $uri;

This will give the current (possibly rewritten) URI, without arguments.

Marcus.



More information about the nginx mailing list