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
Boxiang Sun
gitlab-ce
Commits
cf669551
Commit
cf669551
authored
Apr 07, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put CACHE_NAMESPACE in the Gitlab::Redis module
parent
3137f61a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
config/application.rb
config/application.rb
+1
-3
lib/gitlab/redis.rb
lib/gitlab/redis.rb
+2
-0
lib/tasks/cache.rake
lib/tasks/cache.rake
+1
-1
No files found.
config/application.rb
View file @
cf669551
...
@@ -7,8 +7,6 @@ Bundler.require(:default, Rails.env)
...
@@ -7,8 +7,6 @@ Bundler.require(:default, Rails.env)
require_relative
'../lib/gitlab/redis'
require_relative
'../lib/gitlab/redis'
module
Gitlab
module
Gitlab
REDIS_CACHE_NAMESPACE
=
'cache:gitlab'
class
Application
<
Rails
::
Application
class
Application
<
Rails
::
Application
# Settings in config/environments/* take precedence over those specified here.
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# Application configuration should go into files in config/initializers
...
@@ -70,7 +68,7 @@ module Gitlab
...
@@ -70,7 +68,7 @@ module Gitlab
end
end
redis_config_hash
=
Gitlab
::
Redis
.
redis_store_options
redis_config_hash
=
Gitlab
::
Redis
.
redis_store_options
redis_config_hash
[
:namespace
]
=
REDIS_
CACHE_NAMESPACE
redis_config_hash
[
:namespace
]
=
Gitlab
::
Redis
::
CACHE_NAMESPACE
redis_config_hash
[
:expires_in
]
=
2
.
weeks
# Cache should not grow forever
redis_config_hash
[
:expires_in
]
=
2
.
weeks
# Cache should not grow forever
config
.
cache_store
=
:redis_store
,
redis_config_hash
config
.
cache_store
=
:redis_store
,
redis_config_hash
...
...
lib/gitlab/redis.rb
View file @
cf669551
module
Gitlab
module
Gitlab
class
Redis
class
Redis
CACHE_NAMESPACE
=
'cache:gitlab'
attr_reader
:url
attr_reader
:url
# To be thread-safe we must be careful when writing the class instance
# To be thread-safe we must be careful when writing the class instance
...
...
lib/tasks/cache.rake
View file @
cf669551
...
@@ -9,7 +9,7 @@ namespace :cache do
...
@@ -9,7 +9,7 @@ namespace :cache do
loop
do
loop
do
cursor
,
keys
=
redis
.
scan
(
cursor
,
keys
=
redis
.
scan
(
cursor
,
cursor
,
match:
"
#{
Gitlab
::
R
EDIS_
CACHE_NAMESPACE
}
*"
,
match:
"
#{
Gitlab
::
R
edis
::
CACHE_NAMESPACE
}
*"
,
count:
CLEAR_BATCH_SIZE
count:
CLEAR_BATCH_SIZE
)
)
...
...
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