Added type handling in opIndex and opIndexAssign for Cache and Session