Uncategorized

Caching

Client-side caching: the client stores the cached result and refresh when it wants. Reduced network calls. Cache invalidation is difficult. For example, if your client side cache never expires.

Proxy caching: proxy placed between client and server which caches the responses. Reverse proxies like Squid or Varnish cache HTTP traffic. Comparatively simpler.

Server-side caching: server uses something like in-memory cache, Redis or Memcache. Clients has no idea and don’t worry about data freshness. Somewhat easier cache invalidation (with things like TTL-Time to live and TTI – time to idle) although as Jeff Atwood says there are two hard things in computer science: cache invalidation, naming things, and off-by-one errors

Which data structure would you use for creating your own cache product? How would the API look like? How would you store dates in cache if the date objects are created in different timezones?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s