use hash for cache key

http://manage.dimagi.com/default.asp?110304
Merge pull request #3270 from dimagi/domain-caching

use hash for cache key