Generalise logic for creating Redis storage key strings.