Method: Octopress::Deploy::S3#invalidate_cache

Defined in:
lib/octopress-deploy/s3.rb

#invalidate_cache(files) ⇒ Object



114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/octopress-deploy/s3.rb', line 114

def invalidate_cache(files)
  puts "Invalidating cache for #{pluralize('file', site_files.size)}" if @verbose
  @cloudfront.create_invalidation(
    distribution_id: @distro_id, 
    invalidation_batch:{
      paths:{
        quantity: files.size,
        items: files.map{|file| "/" + remote_path(file)}
      }, 
      # String of 8 random chars to uniquely id this invalidation
      caller_reference: (0...8).map { ('a'..'z').to_a[rand(26)] }.join
    }
  ) unless files.empty?
end