Presentation is loading. Please wait.

Presentation is loading. Please wait.

MIS Professor Sandvig MIS 424 Professor Sandvig

Similar presentations


Presentation on theme: "MIS Professor Sandvig MIS 424 Professor Sandvig"— Presentation transcript:

1 MIS 324 -- Professor Sandvig MIS 424 Professor Sandvig
12/6/2018 Caching MIS 424 Professor Sandvig

2 MIS 324 -- Professor Sandvig
12/6/2018 Overview What is caching Where to cache When to cache Data caching in .NET MVC Create you own cache

3 MIS 324 -- Professor Sandvig
12/6/2018 What is Caching Cache = “store” Armies: cache weapons Birds: cache nuts Computers: cache data Benefits of caching data: Reuse Process once, reuse many times Faster, cheaper

4 Where to cache Browser Network Server Proxy Servers
Content Delivery Networks Server

5 MIS 324 -- Professor Sandvig
12/6/2018 Where to Cache Browser Each resource may specify cache policy Cache-control header Reduces: download times Bandwidth usage Example: WWU Chrome developer tools

6 MIS 324 -- Professor Sandvig
12/6/2018 Where to Cache Network Proxy Server

7 MIS 324 -- Professor Sandvig
12/6/2018 Where to Cache Content Delivery Networks (CDNs) Globally distributed network proxy servers

8 CDNs Amazon CloudFront Akamai video (2.51) 53 Edge Servers
Content delivered from closest to customer Akamai video (2.51)

9 MIS 324 -- Professor Sandvig
12/6/2018 Where to Cache All of the above Nytimes.com Browser caching Content Delivery Network Server Blog on caching

10 MIS 324 -- Professor Sandvig
12/6/2018 When to Cache on server Frequently hit pages Content changes infrequently NYTimes.com ESPN.com CMS (see Drupal Boost) Data is expensive to retrieve MIS 424 Weather forecast Amazon Best Sellers

11 MIS 324 -- Professor Sandvig
12/6/2018 When NOT to cache Pages that change frequently Shopping cart Facebook Customized for each user Infrequently accessed data Cache must be stored  Overhead cost depends upon caching method

12 MIS 324 -- Professor Sandvig
12/6/2018 Caching Tools in .NET Caching Options Output Cache Attribute Cache class Create your own Database Application or session object

13 Output Cache Attribute
Decorate ActionMethod: [OutputCache(Duration=30, VaryByParam="none")] public ActionResult Index() Duration: seconds

14 VaryByParm Example: Keep caches for specific parameters
VaryByParm = “custID” Different cache for each customer VaryByParm = “*” Different cache for all parms Example: VaryByParm=“custID” output

15 Cache Location Client – cached on browser Server – cached on server
ServerAndClient – *default Any – browser & server & proxy servers None – no caching

16 Cache Attribute Apply to controller Apply to partial views
Applies to all action methods in controller Apply to partial views Cache only partial view Example: MVC Music

17 MIS 324 -- Professor Sandvig
12/6/2018 .NET MVC Caching Output Cache Attribute Cache class Create your own

18 MIS 324 -- Professor Sandvig
12/6/2018 Cache Class Set expiration date Several Cache any type of data object strings, List<>, array … Cached data accessible throughout application Use data on multiple page options

19 MIS 324 -- Professor Sandvig
12/6/2018 Cache Class Cache.Insert method Parameters for: Expiration date – absolute & sliding File dependencies Database tables Example: CacheClass source, output

20 MIS 324 -- Professor Sandvig
12/6/2018 Create Your Own Program own rules Customize storage location Database File Combination of cache locations Expiration rule Fixed time of day, week, month… Idle duration Example: Weather history Storage: Sql server database Delete after 180 days PHP: cache to file

21 MIS 324 -- Professor Sandvig
12/6/2018 Summary Caching widely used Browser Network caching Server .NET options: Cache attribute Views and partial views Cache Class Roll your own


Download ppt "MIS Professor Sandvig MIS 424 Professor Sandvig"

Similar presentations


Ads by Google