I agree it is a bit ugly, but the problem with this solution is that you clear cache before checking whether the item is in the cache, in which case it could clear the cached item that we are interested on before we retrieve it