complete commented code

complete commented code for all the caching algorithms