Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 11th, 2013, 01:19 AM
Friend of Wrox
 
Join Date: Mar 2011
Posts: 126
Thanks: 39
Thanked 2 Times in 2 Posts
Default Ch. 15 (p. 571) - Caching Example

Hi Imar,

If user #1 is caching a review and another user (user #2) makes an update to it, how will user #1 know that an update was made? Will the update made by user #2 invalidate the review that's cached for user #1?

Thanks.
Tulsi
 
Old January 11th, 2013, 03:41 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Tulsi,

It depends; if you use the data-source controls with caching enabled on a page to display and edit them, .NET takes care of this. Otherwise, yes, you run into "stale data". if you're doing everything in code you can easily remove the edited item from the cache when you're done saving the changes. Alternatively, when using the data controls, you can handle an Edited event and then update or clear the cache.

Finally, if it's acceptable, you can just wait, if the cache time is short enough. The new item will appear automatically after the old one has expired.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 17th, 2013, 03:10 PM
Friend of Wrox
 
Join Date: Mar 2011
Posts: 126
Thanks: 39
Thanked 2 Times in 2 Posts
Default

Hi Imar,

Thank you for the explanation, but I guess I'm still a little confused as to how the caching works.

Is there one common cache for all users or is there a cache setup for each user?


Thank you.
Tulsi
 
Old January 18th, 2013, 06:48 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

It applies to the entire application, and thus to all users. It's a big bag that can hold all kinds of stuff referred to by a key. In addition, it has behavior to eject items from the cache based on logic (expire date, changed dependencies etc.)

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
CH 15 First Try It Out DataGridView hlakam BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 0 January 6th, 2011 01:21 PM
Ch 15 - Security aspcoder BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 7 May 3rd, 2008 02:55 PM
CH.15 NEED HELP stacy BOOK: Beginning ASP 3.0 1 January 21st, 2004 03:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.