how does internal and external cache work, lets see simple examples on these