generate cache key with no prefix if prefix is either null or empty