Minor change to cache handling

Cache should now be deleted if there are no chars in the DB.