Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Are UserProfiles cached in the core?Are UserProfiles cached in the core?
Previous
 
Next
New Post
1/16/2008 6:59 PM
 

Hi,

I do extensive userprofile caching in all my modules (it's Rodney from Smart-Thinker.com, I can't post new posts with my usual DNN account). I was recently examining my cache with a cache viewer and I think I may be caching duplicate information.

So my quesions are:

1) Are UserProfiles cached in the core?

2) If so, when are they cached, and how? (I saw a method called "ClearUserCache" that takes in a username - I can't find where it is set).

3) If so, what is cached? The profile properties and the roles?

If they are cached then I will change my caching methods to use the same key ( I use string cacheKey = portalID.ToString() + "UserID" + userID.ToString();)  so that I am not doubling the cache info.

 

Out of interest (if you got this far ;) - here is the code that I use:

        public UserInfo GetUserFromCacheOrDB(int portalID, int userID, int profileCacheSeconds)
        {
            string cacheKey = portalID.ToString() + "UserID" + userID.ToString();
            UserInfo user;

            bool userInCache = (DataCache.GetCache(cacheKey) != null);

            if (profileCacheSeconds > 0 && userInCache)
            {
                user = (UserInfo)DataCache.GetCache(cacheKey);
            }
            else
            {
                //get it from the DB
                user = new UserController().GetUser(portalID, userID);

                if (user != null && profileCacheSeconds > 0 && !userInCache)
                {
                    //add it to the cache with an absoulte expiry time (otherwise it may never update)
                    DataCache.SetCache(cacheKey, user, DateTime.Now.AddSeconds(profileCacheSeconds));
                }
            }
            return user;
        }

 


Thanks,
Rodney
Smart-Thinker - Social Networking modules for DotNetNuke
The DotNetNuke Directory - Are you listed?
PokerDIY - Example Implementation of DNN Social Network
Do use DNN a lot? Try the DotNetNuke Toolbar to save you time!
 
New Post
1/17/2008 11:12 AM
 

Rodney,

I have not actually gone diving into the DNN code, but from what I can tell, it does appear that some items are cached for the user, but I am not 100% sure what information is.

You might have a look at the code for signin, as well as the code in the actual DNN Library to see if caching is completed there, essentially behind the scenes.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Are UserProfiles cached in the core?Are UserProfiles cached in the core?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out