Added write stuff to the caching mechanism