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
Tatuya Kamada
gitlab-ce
Commits
764eaedf
Commit
764eaedf
authored
Dec 16, 2014
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve Redis::Store monkey-patch robustness
parent
62ea0274
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
config/initializers/redis-store-fix-expiry.rb
config/initializers/redis-store-fix-expiry.rb
+23
-0
No files found.
config/initializers/redis-store-fix-expiry.rb
View file @
764eaedf
...
...
@@ -4,13 +4,36 @@ module Gitlab
class
Redis
class
Store
module
Namespace
# Redis::Store#expire in redis-store 1.1.4 does not respect namespaces;
# this new method does.
def
setex
(
key
,
expires_in
,
value
,
options
=
nil
)
namespace
(
key
)
{
|
key
|
super
(
key
,
expires_in
,
value
)
}
end
# Redis::Store#expire in redis-store 1.1.4 does not respect namespaces;
# this new method does.
def
expire
(
key
,
expires_in
)
namespace
(
key
)
{
|
key
|
super
(
key
,
expires_in
)
}
end
private
# Our new definitions of #setex and #expire above assume that the
# #namespace method exists. Because we cannot be sure of that, we
# re-implement the #namespace method from Redis::Store::Namespace so
# that it all Redis::Store instances, whether they use namespacing or
# not.
#
# Based on lib/redis/store/namespace.rb L49-51 (redis-store 1.1.4)
def
namespace
(
key
)
if
@namespace
yield
interpolate
(
key
)
else
# This Redis::Store instance does not use a namespace so we should
# just pass through the key.
yield
key
end
end
end
end
end
...
...
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