their traits). Caches results for faster lookup.
322835
static function fieldDefs($childs=null) {
		$gname = get_called_class();
		$key = $gname . ( $childs ? '::' . $childs : '' );
		if (key_exists($key, static::$fieldDefCache)) { return static::$fieldDefCache[$key]; }
		$defs = static::selfFieldDefs($key);
		foreach (class_uses($gname) as $trait) {
			if ('dt' != substr($trait, 0, 2)) { continue; }
			$traitName = substr($trait, 2);
			$callable = [ $gname, 'fieldDefs' . $traitName, ];
			$defs = array_merge($defs, call_user_func($callable, $key));
		}
		if ($parent = get_parent_class($gname)) {
			$defs = array_merge($defs, $parent::fieldDefs($key));
		}
		static::$fieldDefCache[$key] = $defs;
		return $defs;
	}
933735
def lookup_name_fast(self, name):
        """"""

        if name in self.__names:
            return self.__names[name]

        count = self.__get_count_cached()
        lo = 0
        hi = count
        while lo < hi:
            mid = (lo + hi) // 2
            if self.__get_name_cached(mid) < name:
                lo = mid + 1
            else:
                hi = mid

        if lo != count and self.__get_name_cached(lo) == name:
            return self.__get_info_cached(lo)
745441
public static function traits($class, $recursive=false, $autoload=true)
    {

        if (!$recursive) {
            return class_uses($class, $autoload);
        }

        $traits = [];

        // Collect the "use" statements in class and parent classes
        do {
            $traits = array_merge(class_uses($class, $autoload), $traits);
        } while ($class = get_parent_class($class));

        // Copy the found traits into an array we can alter
        $allTraits = $traits;

        foreach ($traits as $trait) {
            $allTraits += static::traitsOfTrait($trait);
        }

        return array_unique($allTraits);
    }
983305
function(paths, callback) {
        var results = [];

        //soft merge
        for(var path in paths) {
            if(paths.hasOwnProperty(path)) {
                acquire.cache[path] = paths[path];
                results.push(acquire.cache[path]);
            }
        }

        callback.apply(null, results);

        return results;
    }
343896
public Set<Type> getDataModelTypes()
        throws CacheReloadException
    {
        final Set<Type> ret = new HashSet<>();
        for (final Long id : this.dataModelTypes) {
            ret.add(Type.get(id));
        }
        return Collections.unmodifiableSet(ret);
    }
855900
protected boolean onCacheMiss(T target) {
        boolean cached = matcher.matches(target);
        map.put(target, cached);
        return cached;
    }
1321766
@Override
	public void cacheResult(List<CPFriendlyURLEntry> cpFriendlyURLEntries) {
		for (CPFriendlyURLEntry cpFriendlyURLEntry : cpFriendlyURLEntries) {
			if (entityCache.getResult(
						CPFriendlyURLEntryModelImpl.ENTITY_CACHE_ENABLED,
						CPFriendlyURLEntryImpl.class,
						cpFriendlyURLEntry.getPrimaryKey()) == null) {
				cacheResult(cpFriendlyURLEntry);
			}
			else {
				cpFriendlyURLEntry.resetOriginalValues();
			}
		}
	}
53525
def detect_traits(item):
    
    return traits.detect_traits(
        name=item.name, alias=item.alias,
        filetype=(list(item.fetch("kind_51")) or [None]).pop(),
    )
132284
private List<Type> getAllChildTypes(final Type _parent)
        throws CacheReloadException
    {
        final List<Type> ret = new ArrayList<>();
        for (final Type child : _parent.getChildTypes()) {
            ret.addAll(getAllChildTypes(child));
            ret.add(child);
        }
        return ret;
    }
191154
private void putInCache(UserProfile profile)
   {
      cache.put(profile.getUserName(), profile, CacheType.USER_PROFILE);
   }
1047137
def _lookup(key):
    
    if key not in _CACHE:
        return None
    if _CACHE_COUNTER[key] >= len(_CACHE[key][1:]):
        if _CACHE[key][0] == "empty":
            return ""
        elif _CACHE[key][0] == "repeat" and _CACHE[key][1:]:
            return _CACHE[key][-1]
        elif _CACHE[key][0] == "repeat":
            return ""
        else:
            _CACHE_COUNTER[key] = 1
    else:
        _CACHE_COUNTER[key] += 1
    if _CACHE[key]:
        return _CACHE[key][_CACHE_COUNTER[key]]
    else:
        return ""
1109520
private static Set<Type> getChildTypes(final Type _type)
        throws CacheReloadException
    {
        final Set<Type> ret = new HashSet<Type>();
        ret.add(_type);
        for (final Type child : _type.getChildTypes()) {
            ret.addAll(getChildTypes(child));
        }
        return ret;
    }
306520
function(overrides) { 
      var result = this.cache;
      if(!result) {
        result = construct(type, functionParameters(type).map(function(paramName) {
          return self.resolve(paramName, overrides);
        }));
      }
      if(doCache) {
        this.cache = result;
      }
      return result;
    }
161832
def _fetch_all(self):
        
        if self._result_cache is None:
            self._result_cache = list(self.iterator())
            # TODO: Do we have to test for ValuesListIterable, ValuesIterable,
            # and FlatValuesListIterable here?
            if self._iterable_class == ModelIterable:
                for x in self._result_cache:
                    self._set_item_querytime(x)
        if self._prefetch_related_lookups and not self._prefetch_done:
            self._prefetch_related_objects()
593387
private function hasPropertiesToCache() {
		if (!isset($this->{__METHOD__})) {
			$this->{__METHOD__} = !!$this->cachedAll();
		}
		return $this->{__METHOD__};
	}
1149467
public boolean hasCache() {
        if (isCache()) {
            return true;
        }
        if (CommonUtils.isNotEmpty(methods)) {
            for (MethodConfig methodConfig : methods.values()) {
                if (CommonUtils.isTrue(methodConfig.getCache())) {
                    return true;
                }
            }
        }
        return false;
    }
699000
@Override
	public void cacheResult(
		List<CPDefinitionLocalization> cpDefinitionLocalizations) {
		for (CPDefinitionLocalization cpDefinitionLocalization : cpDefinitionLocalizations) {
			if (entityCache.getResult(
						CPDefinitionLocalizationModelImpl.ENTITY_CACHE_ENABLED,
						CPDefinitionLocalizationImpl.class,
						cpDefinitionLocalization.getPrimaryKey()) == null) {
				cacheResult(cpDefinitionLocalization);
			}
			else {
				cpDefinitionLocalization.resetOriginalValues();
			}
		}
	}