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
iv
gitlab-ce
Commits
693878cf
Commit
693878cf
authored
Apr 28, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache repo size inside repo model
parent
3471e26f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
app/models/repository.rb
app/models/repository.rb
+16
-0
No files found.
app/models/repository.rb
View file @
693878cf
...
@@ -37,6 +37,22 @@ class Repository
...
@@ -37,6 +37,22 @@ class Repository
raw_repository
.
send
(
m
,
*
args
,
&
block
)
raw_repository
.
send
(
m
,
*
args
,
&
block
)
end
end
# Return repo size in megabytes
# Cached in redis
def
size
Rails
.
cache
.
fetch
(
cache_key
(
:size
))
do
raw_repository
.
size
end
end
def
expire_cache
Rails
.
cache
.
delete
(
cache_key
(
:size
))
end
def
cache_key
(
type
)
"
#{
type
}
:
#{
path_with_namespace
}
"
end
def
respond_to?
(
method
)
def
respond_to?
(
method
)
return
true
if
raw_repository
.
respond_to?
(
method
)
return
true
if
raw_repository
.
respond_to?
(
method
)
...
...
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