Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruby-redis
redis-activesupport-with-cas
Commits
86c42866
Commit
86c42866
authored
Jul 26, 2017
by
Rajko Albrecht
Browse files
Implemented cas_multi into cache
parent
4b892cc2
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/active_support/cache/redis_store_with_cas.rb
View file @
86c42866
...
...
@@ -21,7 +21,28 @@ module ActiveSupport
end
end
def
cas_muli
def
cas_multi
(
*
names
)
options
=
names
.
extract_options!
return
if
names
.
empty?
options
=
merged_options
(
options
)
keys_to_names
=
Hash
[
names
.
map
{
|
name
|
[
normalize_key
(
name
,
options
),
name
]
}]
instrument
(
:cas_multi
,
names
,
options
)
do
@data
.
cas_multi
(
*
(
keys_to_names
.
keys
),
{
:expires_in
=>
cas_expiration
(
options
)})
do
|
raw_values
|
values
=
{}
raw_values
.
each
do
|
key
,
entry
|
values
[
keys_to_names
[
key
]]
=
entry
.
value
unless
entry
.
expired?
end
values
=
yield
values
break
true
if
read_only
mapped_values
=
values
.
map
do
|
name
,
value
|
[
normalize_key
(
name
,
options
),
options
[
:raw
].
present?
?
value
:
Entry
.
new
(
value
,
options
)]
end
Hash
[
mapped_values
]
end
true
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