Code review comment for lp:~mwhudson/launchpad/much-faster-rewrite-map

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Michael Hudson wrote:

>>>> + if prefix in self._cache:
>>>> + branch_id, inserted_time = self._cache[prefix]
>>>> + if (self._now() < inserted_time +
>>>> + config.codehosting.branch_rewrite_cache_lifetime):
>>>> + trailing = location[len(prefix) + 1:]
>>>> + return branch_id, trailing, "HIT"
>>>> + prefixes.append(prefix)
>>>> + result = self.store.find(
>>>> + Branch,
>>>> + Branch.unique_name.is_in(prefixes), Branch.private == False)
>>>> + try:
>>>> + branch_id, unique_name = result.values(
>>>> + Branch.id, Branch.unique_name).next()
>>>> + except StopIteration:
>>>> + return None, None, "MISS"
>> How do we know the Branch was retrieved from the database and not the
>> Storm cache?
>
> We don't. Is there some way I could test for this?

Actually we do: we never retrieve a whole branch object from the
database, so there's nothing for storm to cache.

Cheers,
mwh

« Back to merge proposal