Thanks for the reply!
Yep, I guessed the ngx_memc module will encode the memcached keys.
I decoded the key url initially as "...excludes=n_Bronze,n_genderID,n_Silver..." before ngx.location.capture
And in location /memc-set, the memc_key should be the same as "...excludes=n_Bronze,n_genderID,n_Silver..." since it was encoded then decoded, but I found the key in memcached still holds "...excludes=n_Bronze,n_genderID,n_Silver...", i.e., not being encoded as "%2C"
So, here the difference, if set "...&excludes=n_Bronze,n_genderID,n_Silver&..." as memec_key, the "," was not encoded,
if set "...&excludes=n_Bronze%2Cn_genderID%2Cn_Silver&..." as memec_key, the "%2C" was encoded as "%252C"
Thanks
在 2012年7月3日星期二UTC+8上午1时56分05秒,agentzh写道:
Hello!
On Mon, Jul 2, 2012 at 12:06 AM, james_openresty <ming....@gmail.com> wrote:
> But when I checked memcached, the key was "...
> excludes=n_Bronze%252Cn_genderID%252Cn_Silver...",
> the value was "...excludes=n_Bronze%2Cn_genderID%2Cn_Silver..."
>
> I'd like the key to be same as the value, i.e., %2C not be encoded again as
> %252C
> I know ngx.location.capture will encode the query, but set_unescape_uri
> should restore them back. Why the key can't act the same as the value?
That's because you encoded "," twice but only decode it once :)
The ngx_memc module will encode the memcached keys as URI, just like
the standard ngx_memcached module. And that's why your keys look
different than your values because the key has encoded one more time
:)
Best regards,
-agentzh