Query_String not matching


I am obviously a new nginx user, so please bear with me.

I have setup nginx as a content caching service, running on port 80 and
directing traffic to backend servers.

all works okay, though one specific scenario where i want to cache an
object matching a specific query string.

Here’s a sample:

…/ getimage.view&id=19823&class=5617&size=80

I want to cache objecting matching : class=5617&size=80
since obviously the ID will change depending on user.

i googled nginx config,etc… everything i found simply explains that i
could match $uri and $args but not how to bypass args

i tried the following:

if ($uri ~* “^getimage.view”) {
set $args $2$3;
set $cache_key $scheme$host$uri$is_args$args;

But it’s not working…
any advice? or better yet any place i can learn more about manipulating
query strings ?

Thanks in advance.