Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 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 October 8th, 2007, 09:06 AM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default how cache works

Hello!

This is probably a silly question but how really cache works?

For example, if i have my cache duration to 10 minutes, and if

-one user click on articles page on 10h00 and logout
-other user click on articles page on 10h07 and logout
-other user click on articles page on 10h16 and logout
-other user click on articles page on 10h24 and logout

This means that TBH only retrieve articles list from DB the first time(at 10h00) right?

Somehow I had a doubt if the cache is the server cache or client cache!

------------------------------------

How can I see if aspnet cache profile settings?
I mean, when I call roles.getUsersInRole("Admninistrator"), THH ASPNET will cache this string() ?

I want to cache this... but if aspnet already cache them, i don't want duplicate information!

I'm thinking about make a new class just for cache profile/role/membership settings and all the calls made by UI inherit from this class!

The discussion is open!

 
Old October 8th, 2007, 10:16 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

Maxxim - in the scenario above, the cache would be queried twice (assuming that the 10h00 user accessed the database as the cahce had expired). once with the initial 10h00 query and a second time with the 10h16 query. the cache is DEFINATELY on the server side.

i'm not at my dev machine, so can't check the roles.getUsersInRole settings, but if you can't find explicit cache settings for this, i would ASSUME that asp does this internally. i could be very wrong of course, in which case creating your own routines may be beneficial. however, if you had a ton of users, it may actually use more precious memory caching those than any benefit that it would bring.

jimi

http://www.originaltalent.com
 
Old October 8th, 2007, 01:30 PM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by jimibt
 Maxxim - in the scenario above, the cache would be queried twice (assuming that the 10h00 user accessed the database as the cahce had expired). once with the initial 10h00 query and a second time with the 10h16 query. the cache is DEFINATELY on the server side.
Thanks!
I thought that cacheduration was updated everytime you call this cache key.
For example, if you retrieve the articles list at 10h00 and other user retrieve this same list (using cache) at 10h07 the BLL should update cache duration for 10h10 to 10h17....
I'm going to work in that!

Quote:
quote:i'm not at my dev machine, so can't check the roles.getUsersInRole settings, but if you can't find explicit cache settings for this, i would ASSUME that asp does this internally. i could be very wrong of course, in which case creating your own routines may be beneficial. however, if you had a ton of users, it may actually use more precious memory caching those than any benefit that it would bring.
For example, I want to add moderators to my forums! But as you see here in wrox forum, there are moderators by forum, and they can only edit their forum messages...

Everytime that an user goes to forum or thread or topic page I need to check if this current user is or not is moderator of this!
If I cache my roles.getUsersInRole("Moderators") i only cache a list with ([moderatorName|ForumID]) This list will have something like 30 moderators(+/-) with the benefit i don't need to connect to DB!

I think it's efficient!


 
Old October 8th, 2007, 02:09 PM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

Quote:
quote:Originally posted by Maxxim
 
Quote:
quote:Originally posted by jimibt
Quote:
 Maxxim - in the scenario above, the cache would be queried twice (assuming that the 10h00 user accessed the database as the cahce had expired). once with the initial 10h00 query and a second time with the 10h16 query. the cache is DEFINATELY on the server side.
Thanks!
I thought that cacheduration was updated everytime you call this cache key.
For example, if you retrieve the articles list at 10h00 and other user retrieve this same list (using cache) at 10h07 the BLL should update cache duration for 10h10 to 10h17....
I'm going to work in that!

Quote:
quote:i'm not at my dev machine, so can't check the roles.getUsersInRole settings, but if you can't find explicit cache settings for this, i would ASSUME that asp does this internally. i could be very wrong of course, in which case creating your own routines may be beneficial. however, if you had a ton of users, it may actually use more precious memory caching those than any benefit that it would bring.
For example, I want to add moderators to my forums! But as you see here in wrox forum, there are moderators by forum, and they can only edit their forum messages...

Everytime that an user goes to forum or thread or topic page I need to check if this current user is or not is moderator of this!
If I cache my roles.getUsersInRole("Moderators") i only cache a list with ([moderatorName|ForumID]) This list will have something like 30 moderators(+/-) with the benefit i don't need to connect to DB!

I think it's efficient!
the cache only works in that way if you have slidingexpiration set on it. i'd need to see the cache roles stuff to figure if it were as/more efficient. you need to remember the the cache memory will get flushed (even if it's only been in there for 2 mins) if something comes along that is greater then the available memory. you can of course set the cache to have a high priority to remain in memory.

jimi

http://www.originaltalent.com
 
Old October 8th, 2007, 02:33 PM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes jimi...

the right code for increase cache duration is:

BizObject.Cache.Insert(key, data, Nothing, _
                   System.Web.Caching.Cache.NoAbsoluteExpiration, DateTime.Now.AddSeconds(Settings.CacheDuration))

Don't you prefer this?

>you need to remember the the cache memory will get flushed

It's an option...
I don't cache threadsPosts...
Bytheway, Marco said that users that see one thread read it all from beginning to end!
And TBH cache all thread! has her 2 pages or 20 pages...
For exemple, everyone that see this forum, readed "forumsExtensions" thread! In the Marco philosophies If you wrote an hawser to this topic and i go read it, I will cache 8 pages (8x10 posts) just for read the last post!

This is a waist of cache!

Like I said on the top, TBH cache well some features and bad anothers... I don't cache threads because I bind "threadsViews" embedded in postList and I need to retrieve at this moment if this thread/post is new or not to the user who is seeing it!

I prefer cache something that you are calling everytime from DB!
If everytime I call DB to see if I'm moderator or not... maybe it's good to cache this items!

 
Old October 30th, 2007, 01:09 PM
Authorized User
 
Join Date: Sep 2006
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

On the caching topic, could someone please comment on NHibernate's caching and how it compares with the caching implemented in TBH, as far as performance goes?





Similar Threads
Thread Thread Starter Forum Replies Last Post
about using cache benordz ASP.NET 2.0 Basics 2 April 25th, 2008 09:19 AM
Cache problem alton Classic ASP Basics 3 September 6th, 2004 12:37 PM
cache pab006 Classic ASP Basics 3 January 22nd, 2004 05:29 AM
Cache problem hrishimusale Classic ASP Basics 0 August 27th, 2003 04:00 AM





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