Wednesday, August 18, 2021

What is "Cache Control" in Static Resource ?

We all might have used "Static Resource" for loading Styles (CSS) / scripts (JS) / images and used them in our Visualforce, LWC etc.,  But while creating a static resource, there is an option called "Cache Control".  Ever wondered, what is it for ? This post will help us to understand the significance of "Cache Control"

 






Basically this field does hold two values

    1. Private
    2. Public

Are you under an impression that choosing private will make the resource to be not stored in cache, and choosing "public" will store the resource in cache ?  If yes, then you are wrong.  We need to understand the fact that no mater which option is chosen, the resource will be cached.  Let us understand the significance of those two values

Private : The resource will be cached in the SF server and is confined only to the Current User, which means though the resource is in cache, other User's cannot access the cached resource.  Faster load time can only be observed for the current user as cache is confined only to the Current User's session

Public : The resource will be cached in the SF server and the cache can be used by all the Users across the organization, which means the faster load time can be observed by all the Users.

Source : Static Resource in VF Page

Thanks for being an awesome reader and hope you find this interesting.


 ..Bazingaa..




4 comments: