Caching tips

Click here to load reader

  • date post

    15-Jan-2015
  • Category

    Technology

  • view

    1.783
  • download

    0

Embed Size (px)

description

Tips de caching

Transcript of Caching tips

  • 1. Caching tips Leo Soto M. Continuum Lecture & Beef, Marzo 2013Sunday, March 3, 13

2. Caching tips (for webapps) Leo Soto M. Continuum Lecture & Beef, Marzoss 2013Sunday, March 3, 13 3. There are onlytwo hard thingsin computerscience...Sunday, March 3, 13 4. ...cacheinvalidation andnaming things- Phil KarltonSunday, March 3, 13 5. HTTP CachingClient-side!...or middle-side (proxys!)Conceptos claves: Frescura (freshness) Validacion/InvalidacionSunday, March 3, 13 6. FRESH CACHESHTTP/1.0:Expires: Fri, 01 March 2013 20:00:00 GMTHTTP/1.1:Cache-Control: *pila-de-opciones*Cache-Control: private, max-age=3600Sunday, March 3, 13 7. VALIDATED CACHESHTTP/1.0:Last-Modified / If-Modified-Since304 Not ModifiedHTTP/1.1:ETag / If-None-Match304 Not ModifiedSunday, March 3, 13 8. CACHE INVALIDATIONMETODOS HTTP QUE INVALIDANCACHES FRESCAS:POST /resourceDELETE /resourcePUT /resourceSunday, March 3, 13 9. EN RAILSFRESH CACHES:expires_in 1.hourVALIDATED CACHESif stale?(etag: @modelo) otros_hits_a_la_bdendSunday, March 3, 13 10. stale?(etag: x) -> Etag: md5(expand_cache_key(x)) # File activesupport/lib/active_support/cache.rb, line 77 def expand_cache_key(key, namespace = nil) expanded_cache_key = namespace ? "#{namespace}/" : ""if prefix = ENV["RAILS_CACHE_ID"] || ENV["RAILS_APP_VERSION"]expanded_cache_key