Default the generated cache key to use custom #strftime instead of raw #to_s to achieve more accurate precision

This commit is contained in:
Aaron Lerch
2015-06-25 23:40:18 -04:00
parent c0a82648d5
commit 6892ca39c9
4 changed files with 20 additions and 15 deletions

View File

@@ -72,7 +72,9 @@ module ActiveModel
end
def object_cache_key
(@klass._cache_key) ? "#{@klass._cache_key}/#{@cached_serializer.object.id}-#{@cached_serializer.object.updated_at}" : @cached_serializer.object.cache_key
object_time_safe = @cached_serializer.object.updated_at
object_time_safe = object_time_safe.strftime("%Y%m%d%H%M%S%9N") if object_time_safe.respond_to?(:strftime)
(@klass._cache_key) ? "#{@klass._cache_key}/#{@cached_serializer.object.id}-#{object_time_safe}" : @cached_serializer.object.cache_key
end
def meta