Refactor view cache

This commit is contained in:
2024-02-23 08:31:39 +11:00
parent c27ad28697
commit ae42b4ad30

View File

@@ -12,15 +12,20 @@ module Adamantium
data = JSON.generate(expire: expiry.to_i, content: rendered_content)
path = "#{key}.json"
File.write(File.join(Hanami.app.root, "tmp", path), data)
write(key: key, content: data)
rendered_content
end
private
def write(key:, content:)
filename = "#{key}.json"
path = File.join(Hanami.app.root, "tmp", filename)
File.write(path, content)
end
def read(key:)
filename = "#{key}.json"
path = File.join(Hanami.app.root, "tmp", filename)