better code for clearing the cache