Sha256: aa5c3c722c4cc98be14f099b1e5d1204cc169caa7e53d31c4f839b16990fd609

Contents?: true

Size: 796 Bytes

Versions: 17

Compression:

Stored size: 796 Bytes

Contents

# -*- encoding : utf-8 -*-
# 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
    case
    when new_record?
      "#{self.class.model_name.cache_key}/new"
    when 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

17 entries across 17 versions & 1 rubygems

Version Path
blacklight-5.19.2 app/models/concerns/blacklight/document/cache_key.rb
blacklight-5.19.1 app/models/concerns/blacklight/document/cache_key.rb
blacklight-5.19.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-5.18.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-5.17.2 app/models/concerns/blacklight/document/cache_key.rb
blacklight-5.17.1 app/models/concerns/blacklight/document/cache_key.rb
blacklight-5.17.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-5.16.4 app/models/concerns/blacklight/document/cache_key.rb
blacklight-6.0.0.pre3 app/models/concerns/blacklight/document/cache_key.rb
blacklight-5.16.3 app/models/concerns/blacklight/document/cache_key.rb
blacklight-5.16.2 app/models/concerns/blacklight/document/cache_key.rb
blacklight-5.16.1 app/models/concerns/blacklight/document/cache_key.rb
blacklight-6.0.0.pre2 app/models/concerns/blacklight/document/cache_key.rb
blacklight-6.0.0.pre1 app/models/concerns/blacklight/document/cache_key.rb
blacklight-5.16.0 app/models/concerns/blacklight/document/cache_key.rb
blacklight-5.15.0 lib/blacklight/document/cache_key.rb
blacklight-5.14.0 lib/blacklight/document/cache_key.rb