imgCache implemented

code used to implemented imgCache.