Class: Alula::Edgecast
Constant Summary collapse
- THRESHOLD =
300kB
300 * 1024
Instance Attribute Summary
Attributes inherited from CDN
Instance Method Summary collapse
Methods inherited from CDN
#cdns, cdns, #initialize, load, register
Constructor Details
This class inherits a constructor from Alula::CDN
Instance Method Details
#url_for(name, opts) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/alula/cdns/edgecast.rb', line 5 def url_for(name, opts) file = opts.delete(:file) hosts = File.size(file) < THRESHOLD ? self..small : self..large host = hosts[Digest::MD5.hexdigest(name).to_i(16) % hosts.count] File.join(host, name) end |