Class: Hyrax::CachingIiifManifestBuilder
- Inherits:
-
ManifestBuilderService
- Object
- ManifestBuilderService
- Hyrax::CachingIiifManifestBuilder
- Defined in:
- app/services/hyrax/caching_iiif_manifest_builder.rb
Overview
constructs IIIF Manifests and holds them in the Rails cache, this approach avoids long manifest build times for some kinds of requests, at the cost of introducing cache invalidation issues.
Constant Summary collapse
- KEY_PREFIX =
'iiif-cache-v1'
Instance Attribute Summary collapse
-
#expires_in ⇒ Object
Returns the value of attribute expires_in.
Attributes inherited from ManifestBuilderService
Instance Method Summary collapse
-
#initialize(iiif_manifest_factory: ::IIIFManifest::ManifestFactory, expires_in: Hyrax.config.iiif_manifest_cache_duration) ⇒ CachingIiifManifestBuilder
constructor
A new instance of CachingIiifManifestBuilder.
- #manifest_for(presenter:) ⇒ Object
Methods inherited from ManifestBuilderService
Constructor Details
#initialize(iiif_manifest_factory: ::IIIFManifest::ManifestFactory, expires_in: Hyrax.config.iiif_manifest_cache_duration) ⇒ CachingIiifManifestBuilder
Returns a new instance of CachingIiifManifestBuilder.
20 21 22 23 24 |
# File 'app/services/hyrax/caching_iiif_manifest_builder.rb', line 20 def initialize(iiif_manifest_factory: ::IIIFManifest::ManifestFactory, expires_in: Hyrax.config.iiif_manifest_cache_duration) self.expires_in = expires_in super(iiif_manifest_factory: iiif_manifest_factory) end |
Instance Attribute Details
#expires_in ⇒ Object
Returns the value of attribute expires_in.
11 12 13 |
# File 'app/services/hyrax/caching_iiif_manifest_builder.rb', line 11 def expires_in @expires_in end |
Instance Method Details
#manifest_for(presenter:) ⇒ Object
28 29 30 31 32 |
# File 'app/services/hyrax/caching_iiif_manifest_builder.rb', line 28 def manifest_for(presenter:) Rails.cache.fetch(manifest_cache_key(presenter: presenter), expires_in: expires_in) do super end end |