3e561736b2
By caching the number of personal SSH keys we reduce the number of queries necessary on pages such as ProjectsController#show (which can end up querying this data multiple times). The cache is refreshed/flushed whenever an SSH key is added, removed, or when a user is removed.
12 lines
261 B
Ruby
12 lines
261 B
Ruby
module Projects
|
|
# Service class for getting and caching the number of forks of a project.
|
|
class ForksCountService < Projects::CountService
|
|
def relation_for_count
|
|
@project.forks
|
|
end
|
|
|
|
def cache_key_name
|
|
'forks_count'
|
|
end
|
|
end
|
|
end
|