Hot can I use cache do command inside module?
Example
module MyModule
def self.some_method(str)
cache str do
... some code ...
end
end
end
Thx!
Hot can I use cache do command inside module?
Example
module MyModule
def self.some_method(str)
cache str do
... some code ...
end
end
end
Thx!
Assuming you're using Rails, you can do it like so:
module MyModule
def self.some_method(str)
Rails.cache.fetch(str) do
# ...
end
end
end