Sha256: 31a905a24b7a2765a5964284a5e06dc1d0771e8421d5c673cef179610e4ab1de

Contents?: true

Size: 819 Bytes

Versions: 21

Compression:

Stored size: 819 Bytes

Contents

# frozen_string_literal: true

# This module provides the cache key which can be used by rails
# caching to determine when to expire a particular object's cache
# See http://apidock.com/rails/ActiveRecord/Integration/cache_key
# This key should be used in conjunction with additional data to
# determine when a document can be cached (e.g. for different view
# types in search results like gallery and list)
module Blacklight::Document::CacheKey
  def cache_key
    if new_record?
      "#{self.class.model_name.cache_key}/new"
    elsif key? cache_version_key
      cache_version_value = self[cache_version_key]
      "#{self.class.model_name.cache_key}/#{id}-#{Array(cache_version_value).join}"
    else
      "#{self.class.model_name.cache_key}/#{id}"
    end
  end

  def cache_version_key
    :_version_
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
blacklight-8.6.1 app/models/concerns/blacklight/document/cache_key.rb
blacklight-8.6.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-8.5.1 app/models/concerns/blacklight/document/cache_key.rb
blacklight-8.5.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-8.4.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-8.3.0/app/models/concerns/blacklight/document/cache_key.rb
blacklight-8.3.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-8.2.2 app/models/concerns/blacklight/document/cache_key.rb
blacklight-8.2.1 app/models/concerns/blacklight/document/cache_key.rb
blacklight-8.2.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-8.1.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-8.0.1 app/models/concerns/blacklight/document/cache_key.rb
blacklight-8.0.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-8.0.0.beta8 app/models/concerns/blacklight/document/cache_key.rb
blacklight-8.0.0.beta7 app/models/concerns/blacklight/document/cache_key.rb
blacklight-8.0.0.beta6 app/models/concerns/blacklight/document/cache_key.rb
blacklight-8.0.0.beta5 app/models/concerns/blacklight/document/cache_key.rb
blacklight-8.0.0.beta4 app/models/concerns/blacklight/document/cache_key.rb
blacklight-8.0.0.beta3 app/models/concerns/blacklight/document/cache_key.rb
blacklight-8.0.0.beta2 app/models/concerns/blacklight/document/cache_key.rb