optimisation: improve performance of permission cache
Don't update the cache when the permission is already in it. This
saves list munching and a 'put' at the expense of no longer being
strictly LRU, but that only affects pathological cases.