reverted to inline ifs before calling getCacheKey