Add permission_sort cache to remember sort orderings Running the MostSpecificComparator on each access control request to determine the order of AccessSections is expensive, especially when regular expressions are used in sections and must be converted to Automatons to evaulate their distance from the target. Cache the order sections should be sorted in, making any future sorting for the same reference name and same set of section patterns cheaper. Since the sorting is not project specific, the cache can be more general and cover a lot of the server if most sections are defined by parent projects. We don't need to worry about flushing this cache, as it only sorts the sort order, and the original input order is part of the cache element key. Any changes to access controls will still be reflected in the result, and a change in inheritance or addition/removal of sections will cause a new cache key to be used, discarding the prior one via LRU when the cache is full. Change-Id: Ied06561c9124f6ba8f5ea857a0eb17f47db2bc23 
7 files changed