diff options
author | Michael Kozono <mkozono@gmail.com> | 2018-09-25 20:07:59 +0300 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2018-09-28 01:16:09 +0300 |
commit | d9c4ebc5a0b2e911f17865e482de1dfcc2189ac3 (patch) | |
tree | 17da1018b4eabbc858f33568e03cf944b946331c /app/models/repository.rb | |
parent | 0920342094ae07d7225b42cf23cf9637076d2b25 (diff) |
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`.
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 12fbf7d5d1d..7a6dfada917 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -612,7 +612,7 @@ class Repository Licensee::License.new(license_key) end - cache_method :license, memoize_only: true + memoize_method :license def gitignore file_on_head(:gitignore) |