Changed cache cleanup to remove locking and deadlock issue