Calculates a cacheKey for the given treeType. It is expected to return a cache key allowing multiple builds of the same tree to simply return the original tree (preventing duplicate work). If it returns null / undefined the tree in question will opt out of this caching system. This
(treeType)
| 654 | @return {String} cacheKey |
| 655 | */ |
| 656 | cacheKeyForTree(treeType) { |
| 657 | let methodsToValidate = methodsForTreeType(treeType); |
| 658 | let cacheKeyStats = heimdall.statsFor('cache-key-for-tree'); |
| 659 | |
| 660 | // determine if treeFor* (or other methods for tree type) overrides for the given tree |
| 661 | let modifiedMethods = methodsToValidate.filter((methodName) => this[methodName] !== addonProto[methodName]); |
| 662 | |
| 663 | if (modifiedMethods.length) { |
| 664 | cacheKeyStats.modifiedMethods++; |
| 665 | cacheKeyLogger.info(`Opting out due to: modified methods: ${modifiedMethods.join(', ')}`); |
| 666 | return null; // uncacheable |
| 667 | } |
| 668 | |
| 669 | // determine if treeForMethods overrides for given tree |
| 670 | if (this.treeForMethods[treeType] !== DEFAULT_TREE_FOR_METHODS[treeType]) { |
| 671 | cacheKeyStats.treeForMethodsOverride++; |
| 672 | cacheKeyLogger.info('Opting out due to: treeForMethods override'); |
| 673 | return null; // uncacheable |
| 674 | } |
| 675 | |
| 676 | // compute cache key |
| 677 | let cacheKey = calculateCacheKeyForTree(treeType, this); |
| 678 | |
| 679 | return cacheKey; // profit? |
| 680 | }, |
| 681 | |
| 682 | /** |
| 683 | This method climbs up the hierarchy of addons |
nothing calls this directly
no test coverage detected
searching dependent graphs…