Cached scripting flow doesnt work

I try to run the basic script but that doesnt work:

if cached 0
navigate google.com
else
navigate yahoo.com
endif

issue- In both the first view and repeat view both the sites are navigated.

Query- Could you please help with the existing issue? Could you suggest an alternative approach?