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

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesshared variables vs dnn (asp.net) cacheshared variables vs dnn (asp.net) cache
Previous
 
Next
New Post
3/7/2015 9:41 PM
 
What's the point of asp.net /dnn cache when you can save shared info as global variables in shared classes? Because you need to know that variables in user controls get cleared on every postback, but variables in shared classes persist.

Shared variables are better because 1. they would be a little faster than cache because cache needs to lookup dictionary. 2. they are more readable, easier to use

Am I missing something? Is there some trick with portals? if 2 portals use my module, will values in shared class variables be different in portals and same in cache?
 
New Post
3/7/2015 10:47 PM
 
I did some research and found out thread safety and memory could be problem (cache can save data to disk if it gets to big i guess). but if variable is small and readonly shared variables are ok. as long as you do lock(SharedVar) (C#) when you are assigning value to your shared variable.
 
New Post
3/8/2015 7:22 AM
 

 

Hi asp.net / dnn cache is designed to contain more data then variables.

If include also dependecy mechanisme, for clearing cache part when the cache becaumes to big or when the cache becaumes invalid (depending on time delais, file changes, ...).

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesshared variables vs dnn (asp.net) cacheshared variables vs dnn (asp.net) cache


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