Sha256: db3101355f8069dd9366597679297e5124f3238f85ca47e1fc1f69020947bae3

Contents?: true

Size: 818 Bytes

Versions: 75

Compression:

Stored size: 818 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

75 entries across 75 versions & 2 rubygems

Version Path
blacklight-7.40.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-7.39.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-7.38.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/app/models/concerns/blacklight/document/cache_key.rb
blacklight-7.37.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-7.36.2 app/models/concerns/blacklight/document/cache_key.rb
blacklight-7.36.1 app/models/concerns/blacklight/document/cache_key.rb
blacklight-7.36.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-7.35.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-7.34.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-7.33.1 app/models/concerns/blacklight/document/cache_key.rb
blacklight-7.33.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-7.32.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-7.31.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-7.30.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-7.29.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-7.28.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-7.27.1 app/models/concerns/blacklight/document/cache_key.rb
blacklight-7.27.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-7.26.1 app/models/concerns/blacklight/document/cache_key.rb