Move code to cleanup ImageCache to a common place

This commit moves the cleanup code of ImageCache to a
common place in image_cache.py so that it can be accessed
from anywhere in the ironic source tree outside pxe driver.

Change-Id: Idb54cee6cc1eee4f52ff07f8ca6e1f83378b2296
refactor code

Change-Id: Id0a4b0fab797c884448a27b1cd5e3a1da05786a7