Skip to main content

Common items to cache client-side

Naturally, what you will want to cache in a client's browser depends a lot on your use case, but some prominent examples are below.

User site preferences

Settings that a user has selected when browsing your site, like their selected visual theme, are well worth caching. Not doing so means your users will be creating a new AJAX request to your servers every time they load a page, to know which version of the site they should be loading, which heavily increases server load.

Non-sensitive user information

Since not all of a user's information is going to be available on a page, things like a user's internal ID or other information can be kept in the browser cache, so that they can be used in AJAX requests where needed instead of having to ask the server for them. Do not store sensitive or security-related variables in client-side storage or caching for any reason!

Information that rarely changes

This is a general theme of all caching, but if for instance your site has non-sensitive variables often used on a given page - such as maximum upload limits or the like - it makes sense to cache these for a period of time, rather than requesting them from the server every time they're needed.