Code cleanup: prettier cache keys

Computing cache keys with join() is a bit prettier than lots of
concatenations. Only done for cache keys with at least two variable
compontents.