Skip to content

Commit

Permalink
Engine config: replace #cache_duration_in_days with #cache_duration
Browse files Browse the repository at this point in the history
  • Loading branch information
dunn authored and jcoyne committed Dec 12, 2017
1 parent 6acf20d commit 3584485
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ end
# Rails.cache. Some cache stores may not automatically purge expired content,
# such as the default FileStore.
# http://guides.rubyonrails.org/caching_with_rails.html#cache-stores
Riiif::Engine.config.cache_duration_in_days = 30
Riiif::Engine.config.cache_duration = 30.days
```
#### Special note for Passenger and Apache users
If you are running riiif in Passenger under Apache, you must set the following in your virtual host definition:
Expand Down
9 changes: 8 additions & 1 deletion app/models/riiif/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ def info

class << self
def expires_in
Riiif::Engine.config.cache_duration_in_days.days
if Riiif::Engine.config.respond_to?(:cache_duration_in_days)
Deprecation.warn(self,
'Riiif::Engine.config.cache_duration_in_days is deprecated; '\
'use #cache_duration instead and pass a fully-qualified date (e.g., `3.days`)')
Riiif::Engine.config.cache_duration_in_days.days
else
Riiif::Engine.config.cache_duration
end
end

def cache_key(id, options)
Expand Down
2 changes: 1 addition & 1 deletion lib/riiif/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Engine < ::Rails::Engine
require 'riiif/rails/routes'

# How long to cache the tiles for.
config.cache_duration_in_days = 3
config.cache_duration = 3.days

config.action_dispatch.rescue_responses['Riiif::ImageNotFoundError'] = :not_found

Expand Down

0 comments on commit 3584485

Please sign in to comment.