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
37465f44
Commit
37465f44
authored
Nov 13, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9825 from huacnlee/cache-application-setting
Add caching for ApplicationSetting, Ci::ApplicationSetting.
parents
b72cbd8d
2e4a673c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
app/models/application_setting.rb
app/models/application_setting.rb
+7
-1
app/models/ci/application_setting.rb
app/models/ci/application_setting.rb
+8
-2
No files found.
app/models/application_setting.rb
View file @
37465f44
...
...
@@ -68,8 +68,14 @@ class ApplicationSetting < ActiveRecord::Base
end
end
after_commit
do
Rails
.
cache
.
write
(
'application_setting.last'
,
self
)
end
def
self
.
current
ApplicationSetting
.
last
Rails
.
cache
.
fetch
(
'application_setting.last'
)
do
ApplicationSetting
.
last
end
end
def
self
.
create_from_defaults
...
...
app/models/ci/application_setting.rb
View file @
37465f44
...
...
@@ -12,9 +12,15 @@
module
Ci
class
ApplicationSetting
<
ActiveRecord
::
Base
extend
Ci
::
Model
after_commit
do
Rails
.
cache
.
write
(
'ci_application_setting.last'
,
self
)
end
def
self
.
current
Ci
::
ApplicationSetting
.
last
Rails
.
cache
.
fetch
(
'ci_application_setting.last'
)
do
Ci
::
ApplicationSetting
.
last
end
end
def
self
.
create_from_defaults
...
...
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