backported permissions cache from 7.1 for speed
Merge branch 'permission_cache' into v7

* permission_cache:
  backported permissions cache from 7.1 for speed