Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
d8e045267574
Commit
f7f6acee
authored
May 15, 2013
by
Dmitriy Zaporozhets
Browse files
Lets cache branch_names, tag_names for repo
parent
122a5340b268
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/models/repository.rb
View file @
d8e04526
...
...
@@ -33,6 +33,18 @@ def commits_between(target, source)
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 @@ def size
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
)
...
...
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