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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
42ab6f85
Commit
42ab6f85
authored
May 16, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move attribute casting to #cached_attribute
parent
6cc3a07d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
app/models/concerns/redis_cacheable.rb
app/models/concerns/redis_cacheable.rb
+3
-4
No files found.
app/models/concerns/redis_cacheable.rb
View file @
42ab6f85
...
...
@@ -8,16 +8,15 @@ module RedisCacheable
def
cached_attr_reader
(
*
attributes
)
attributes
.
each
do
|
attribute
|
define_method
(
attribute
)
do
cached_value
=
cached_attribute
(
attribute
)
cached_value
=
cast_value_from_cache
(
attribute
,
cached_value
)
if
cached_value
cached_value
||
read_attribute
(
attribute
)
cached_attribute
(
attribute
)
||
read_attribute
(
attribute
)
end
end
end
end
def
cached_attribute
(
attribute
)
(
cached_attributes
||
{})[
attribute
]
cached_value
=
(
cached_attributes
||
{})[
attribute
]
cast_value_from_cache
(
attribute
,
cached_value
)
if
cached_value
end
def
cache_attributes
(
values
)
...
...
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