Skip to content

Commit b377a22

Browse files
authored
Merge pull request #2 from jackcompton/master
Allow setting expires_in for CSS cache entries
2 parents 1fc8567 + 058fe9c commit b377a22

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/critical-path-css-rails.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
module CriticalPathCss
66
CACHE_NAMESPACE = 'critical-path-css'
77

8-
def self.generate(route)
8+
def self.generate(route, expires_in: nil)
99
::Rails.cache.write(
1010
route,
1111
CssFetcher.new(config).fetch_route(route),
1212
namespace: CACHE_NAMESPACE,
13-
expires_in: nil
13+
expires_in: expires_in
1414
)
1515
end
1616

17-
def self.generate_all
17+
def self.generate_all(expires_in: nil)
1818
CssFetcher.new(config).fetch.each do |route, css|
19-
::Rails.cache.write(route, css, namespace: CACHE_NAMESPACE, expires_in: nil)
19+
::Rails.cache.write(route, css, namespace: CACHE_NAMESPACE, expires_in: expires_in)
2020
end
2121
end
2222

0 commit comments

Comments
 (0)