-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Process typePolicies lazily, upon first access by getTypePolicy.
Passing typePolicies to the InMemoryCache constructor is something that typically happens during application startup, so it's important that the processing of typePolicies does not become a performance problem. Fortunately, we don't have to do all the processing of typePolicies until we actually look up a given type policy for the first time, which might occur much later in the lifetime of the application for some types. Once we implement inheritance of typePolicies, there will often be supertype-subtype relationships among the types listed in typePolicies. Without the laziness introduced by this commit, it would be necessary either to keep typePolicies in supertypes-before-subtypes (topological) order, or for addTypePolicies somehow to sort the types topologically. Fortunately, that careful ordering/sorting becomes completely unnecessary thanks to the laziness, because none of the types can be used until all of them have been registered.
- Loading branch information
Showing
1 changed file
with
81 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters