Commit Graph

6 Commits

Author SHA1 Message Date
Michael Kozono f2fa7c10c8 Remove send-in-send for safety and readability
I attempted to refactor so that the caller of `wrap_method` passes in a
block, rather than a method name, but I was unsuccessful.

I kept getting the following error:

NoMethodError:
        undefined method `cache_method_output' for Repository:Class

If you can figure this out, then feel free to dry up these class methods
again without doing a send-within-a-send.
2018-09-27 18:22:37 -07:00
Michael Kozono 87a1ba1488 Expire RequestStore cache properly 2018-09-27 18:22:37 -07:00
Michael Kozono 3640292bf2 Cache `Repository#exists?` false in RequestStore
* Only truthy values are cached in Redis.
* All values are cached in RequestStore and in an instance variable.
2018-09-27 18:22:37 -07:00
Michael Kozono d9c4ebc5a0 Extract `Repository.memoize_method` method
And reuse `Gitlab::Utils::StrongMemoize`.

There is a subtle behavior change required to reuse StrongMemoize in
this case. The early fallback check now occurs *before* reading the
memoized value instead of after.

I think this is fine since a memoized value should only exist if
`exists?` is also already memoized as `true`.
2018-09-27 15:16:09 -07:00
Imre Farkas d4d6528c86
Expire correct method caches after HEAD changed 2018-06-29 17:41:57 +02:00
Alejandro Rodríguez 5171e2f3d4 Refactor RepositoryCache to make it usable in other classes 2018-03-06 21:12:29 -03:00