WP-Super-Cache instead of using if why not use mapping on nginx?

Article: https://rtcamp.com/wordpress-nginx/tutorials/single-site/wp-super-cache/ And the same config use on EE. I think nginx map work faster and less overhead.

Nginx map was used for WordPress Multisite file handling before WordPress 3.0.

Nginx map won’t be useful for full-page caching.

You may like ti try new redis-cache feature we added in recent release - https://rtcamp.com/blog/easyengine-3-3-full-page-redis-cache/

And why? Having multiple if statement vs using map I think has a lot of performance gap.

Nginx map works like switch/case statement.

Every if condition checks different condition. So in this case, if cannot be replaced by map.


if ($country = "US" ) {  $currency = "USD" ) };
if ($country = "IN" ) {  $currency = "INR" ) };
if ($country = "UK" ) {  $currency = "GBP" ) };

Can be converted into map:

map $country $currency{
 "US" "USD"; 
 "IN" "INR";
 "UK" "GBP";


if ($country = "US" ) {  $currency = "USD" ) };
if ($IP = "<some range>" ) {  $currency = "INR" ) };
if ($language = "english-uk" ) {  $currency = "GBP" ) };

Can not be converted into map. Even though output controls same variable, input differs everytime.

Please let me know if I am mistaken anywhere.

1 Like

Hi @RoldanLT

I hope your query is resolved. I am closing this support topic for now.

Feel free to create a new support topic if you have any queries further. :slight_smile: