caches case-when statement for better performance
Merge pull request #3 from frsyuki/master

Caches case-when statement for better performance