Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
f7f6acee
Commit
f7f6acee
authored
11 years ago
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lets cache branch_names, tag_names for repo
parent
e36c0c14
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
app/models/repository.rb
app/models/repository.rb
+14
-0
No files found.
app/models/repository.rb
View file @
f7f6acee
...
...
@@ -33,6 +33,18 @@ class Repository
commits
end
def
branch_names
Rails
.
cache
.
fetch
(
cache_key
(
:branch_names
))
do
raw_repository
.
branch_names
end
end
def
tag_names
Rails
.
cache
.
fetch
(
cache_key
(
:tag_names
))
do
raw_repository
.
tag_names
end
end
def
method_missing
(
m
,
*
args
,
&
block
)
raw_repository
.
send
(
m
,
*
args
,
&
block
)
end
...
...
@@ -47,6 +59,8 @@ class Repository
def
expire_cache
Rails
.
cache
.
delete
(
cache_key
(
:size
))
Rails
.
cache
.
delete
(
cache_key
(
:branch_names
))
Rails
.
cache
.
delete
(
cache_key
(
:tag_names
))
end
def
cache_key
(
type
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment