Heat the milk and vanilla until just simmering.
Whisk yolks, sugar and cornflour until pale.
Slowly whisk in hot milk.
Return to pan and cook over low heat, whisking, until thick.
Stir in the butter, strain and chill.
Beat butter, sugar and almond extract until creamy.
Add eggs one at a time, then mix in flour and salt.
Divide into 2 discs, wrap and chill for 1 hour.
If using fresh cherries, sauté them with sugar for 2–3 mins until soft and syrupy. Let cool.
If using jam, just stir to loosen.
Preheat oven to 180°C (350°F) fan.
Grease a 22 cm tart tin.
Roll one disc to about 26 cm and line the base and sides of the tin, leaving a little excess to help seal.
Spoon the cherries or jam into the base.
Whisk the chilled custard and gently spread it over the top.
Roll out the second disc to 22 cm, lay over the filling, seal the edges, then trim away any excess.
Brush the top with yolk and score a criss-cross pattern.
Bake for 35 mins until golden.
Cool completely, then chill for at least 2 hours before slicing.
