O'Reilly logo

hapi.js in Action by Matt Harrison

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Cache me if you can

This chapter covers

  • Managing client-side caching
  • Introducing Catbox
  • Server-side caching with hapi

There are two things that we always want to do in web applications:

  • Give users the most up-to-date, relevant data that we can get our hands on
  • Make the experience as quick as possible

We can’t always have both at the same time, so we find a compromise. Caching is the name of that compromise. Caching lets us serve data that is fresh enough, with the benefit that we can serve it a lot faster. It’s common sense, and sometimes this isn’t much of a compromise to make as figure 8.1 illustrates—in particular, when your data changes infrequently.

Figure 8.1. The server-side caching trade-off

It’s faster to serve ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required