Why kaya must be cooked slowly
Kaya is a stirred custard, and a custard is a race you must not win too fast. Egg proteins are long chains folded into tight balls. As they warm they unfold and link to one another, trapping the liquid around them in a soft gel: the custard thickens. A few degrees hotter and the links multiply and tighten, squeezing the liquid back out, and the smooth custard breaks into grainy curds in a thin syrup. The gap between thick and curdled is narrow. A bowl over simmering water cannot get hot enough, fast enough, to cross it without warning, and constant stirring keeps the mixture at the bottom from racing ahead of the rest. It is slow because it has to be.
What the sugar does
Sugar gets between the egg proteins and makes it harder for them to link. A very sweet custard sets at a higher temperature and is more forgiving. Kaya has a great deal of sugar, which is one reason it works at all.
Why it keeps
All that sugar binds water, leaving little available for microbes. Kaya is a preserve, like jam, though a fragile one because of the eggs and coconut. It needs the fridge.
Why strain the mixture
Straining removes the stringy parts of the egg white, which would otherwise cook into white threads.
Why brown kaya tastes of toffee
Hainanese kaya gets its colour and flavour from caramel. When sugar is heated on its own past its melting point it begins to break down, and hundreds of new compounds form: some nutty, some buttery, some pleasantly bitter. The longer it cooks, the darker and more bitter it becomes. Stirred into coconut milk and egg, a deep amber caramel gives kaya a toffee richness and a brown colour that no amount of slow cooking would produce at custard temperatures. Palm sugar, which is already brown and complex in flavour, does a similar job more gently.
Why the coconut milk matters
Coconut milk is fat suspended in water. Its fat gives kaya richness and gloss and carries the scent of the pandan. Thin or stale coconut milk makes thin or flat kaya.
Why green kaya is not very green
The colour is chlorophyll from pandan juice, which dulls with heat. Home-made kaya is a soft olive or yellowish green. Bright green means colouring.
Why it thickens in the fridge
Coconut fat is solid when cold, and the egg gel firms as it cools. Kaya that seems loose when hot will be spreadable next morning.
Kind
A stirred egg custard
Thickens
As egg proteins link
Danger
Curdling, a few degrees later
Sugar
Protects the eggs and preserves
Brown
From caramel or palm sugar
Green
From pandan; fades with heat