Book Image

ServiceStack 4 Cookbook

Book Image

ServiceStack 4 Cookbook

Overview of this book

Table of Contents (18 chapters)
ServiceStack 4 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Introduction


Often, when scaling a web application, at some point it starts to make sense to include a distributed-memory cache. While this can sound exotic, and it can introduce some complexity, the basic idea is very simple. At its most basic, what a cache allows you to do is store a bit of information any way you want, optimized for nearly immediate retrieval.

For instance, you might have a product catalog in a database containing tens of thousands of stock keeping units (SKUs). You query this database fairly often to get the list of the top 100 items that are actually available for sale right now. Your database is pretty well optimized, and that query runs fairly quickly, but it still puts a fair amount of load on your database servers to do it on every page load.

What a cache could allow you to do is create a List<Product> that contains this often-needed list and then refer to it easily in code. The cache server stores the list in-memory, not on disk, which means that retrieval...