caching go big or go home - ndc 2016
TRANSCRIPT
RFC 7234 - HTTP/1.1 Caching
A stored response can be considered fresh
if the response can be reused without validation
RFC 7234 - HTTP/1.1 Caching
Although caching is an entirely OPTIONAL feature of HTTP, it can be assumed that reusing a cached response is desirable and that such reuse is the default behavior when no requirement or local configuration prevents it. Therefore, HTTP cache requirements are focused on preventing a cache from either storing a non-reusable response or reusing a stored response inappropriately, rather than mandating that caches always store and reuse particular responses.
RFC 7234 - HTTP/1.1 Caching
Freshness
• s-max-age
• max age
• Expires
• heuristics
Last modified Last requested Now
Tid
RFC 7234 - HTTP/1.1 Caching
Freshness
• s-max-age
• max age
• Expires
• heuristics
Validation - RFC 7232
• Etag
• Last-Modified
• If-none-match
• If-modified-since
RFC 7234 - HTTP/1.1 Caching
Links
• RFC 7234 - https://tools.ietf.org/html/rfc7234
• RFC 7232 - https://tools.ietf.org/html/rfc7234
• Mark Nottingham - https://www.mnot.net/cache_docs
• Darrel Miller - http://bizcoder.com/caching-is-hard-draw-me-a-picture
• Jesse Wilson – https://publicobject.com/2015/03/26/how-do-http-caching-heuristics-work
Application cache
• ASP.NET Core (or Microsoft.extensions.caching)
• Local cache
• Redis
• Redis with msgpack
• Distributed layered cache
• With synchronization
Microsoft.Extensions.Caching
IMemoryCache
• Powered by dictionary
• Supports callback oneviction.
• Has priority on items in cache
• Compacts on GC Gen2
Microsoft.Extensions.Caching
IMemoryCache
• Powered by dictionary
• Supports callback oneviction.
• Has priority on items in cache
• Compacts on GC Gen2
IDistributedCache
• MemoryCache
• Redis
• SQL Server
• You do the serialization
Redis
• http://redis.io
• Key value store + data structures
• By Salvatore Sanfilippo / @antirez
• Ansi C
• Single threaded
• Lua in server
• Microsoft research port to windows – nuget redis-64
• On Azure, AWS og Google cloud.