# Is there a better way?

**URL:** <https://www.ruby-forum.com/t/is-there-a-better-way/203370>\
**Category:** NGINX\
**Created:** [February 18, 2011, 4:05pm UTC](https://www.ruby-forum.com/t/is-there-a-better-way/203370 "2011-02-18T16:05:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [February 18, 2011, 4:05pm UTC](https://www.ruby-forum.com/t/is-there-a-better-way/203370/1 "2011-02-18T16:05:11Z")

</div>

location /assets/ {  
if ($uri ~ “^/assets/([a-zA-Z0-9]+)(/.+)”) {  
#$1 is hash, $2 is uri  
set $memcached\_key “$1\_$2”;  
memcached\_pass localhost:11211;

#fallback if not in memcached  
error\_page 404 =200  
/libraries/domain/asset\_filter/client/static.php?hash=$1&uri=$2;  
}  
}

This works but is there a better way?  
Sent on the Sprint Now Network from my BlackBerry
