Module: CollectionCacheKey::CacheKey

Defined in:
lib/collection_cache_key/cache_key.rb

Instance Method Summary collapse

Instance Method Details

#cache_timestamp_formatObject



13
14
15
# File 'lib/collection_cache_key/cache_key.rb', line 13

def cache_timestamp_format
  :nsec
end

#collection_cache_key(collection = as_default_relation, timestamp_column = :updated_at) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/collection_cache_key/cache_key.rb', line 3

def collection_cache_key(collection = as_default_relation,
                         timestamp_column = :updated_at) # :nodoc:

  key, size, timestamp = details_for(collection, timestamp_column)

  return "#{key}-#{size}" unless timestamp
  "#{key}-#{size}-#{time_to_string(timestamp)}"
end