Commit 7be65f5d authored by Matija Čupić's avatar Matija Čupić

Add cached_attr_time_reader to RedisCacheable

parent c8bfb3e4
......@@ -12,6 +12,15 @@ module RedisCacheable
end
end
end
def cached_attr_time_reader(*attributes)
attributes.each do |attribute|
define_method("#{attribute}") do
cached_value = cached_attribute(attribute)
cached_value ? Time.zone.parse(cached_value) : read_attribute(attribute)
end
end
end
end
def cached_attribute(attribute)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment