Evolution of behavioural mechanisms underpinning spatial memory