I am using a static dictionary to objects (like cache) but woundered
if it is better to use cache.
Which one would should I use? 6 7282
It depends on what you need ;-p
Most importantly, most cache implementations will provide thread
safety, which a static dictionary (by itself) doesn't - you'd need to
do your own synchronization . But cache implementations may also offer
options for lifetime, dependencies (file system, etc), serialization,
etc.
Marc
Where you use this,
It makes a big difference by instance if it is in
A web application
A forms application
A service application
And that is then the start.
Cor
<Pa************ *@gmail.comschr eef in bericht
news:c7******** *************** ***********@1g2 000prg.googlegr oups.com...
>I am using a static dictionary to objects (like cache) but woundered
if it is better to use cache.
Which one would should I use?
Where you use this,
[web/forms/service]
My understanding is that it *used* to make a lot more difference,
since without "web" it didn't fire up a thread to recover the memory -
but I thought that was now fixed, allowing you to use the cache from
System.Web in any scenario? Correct me if I am wrong...
And of course that is just the System.Web cache; most implementations
are architecture neutral / agnostic.
Marc
On May 18, 5:41*pm, Marc Gravell <marc.grav...@g mail.comwrote:
Where you use this,
[web/forms/service]
My understanding is that it *used* to make a lot more difference,
since without "web" it didn't fire up a thread to recover the memory -
but I thought that was now fixed, allowing you to use the cache from
System.Web in any scenario? Correct me if I am wrong...
And of course that is just the System.Web cache; most implementations
are architecture neutral / agnostic.
Marc
Hi thank you for that.
I am using a Web application. The reason why I am asking this
question is the memory usage, as currently we are getting out of
memory errors, though these dictionary objects only take 27 meg of
memory, would putting these into Cache would be better from a memory
point of view?
Well, the cache is likely to have more sophisticated scavenging
rules... but this isn't a great help if your code detects the missing
cache data and simply re-fetches it.
If you are getting memory errors, I'd first want to understand where
all the memory has gone, with profiling tools (the inbuilt performance
counters are the first thing to look at - what is the memory graph
like? a diagonal line is never good...) Pa************* @gmail.com wrote:
Hi thank you for that.
I am using a Web application. The reason why I am asking this
question is the memory usage, as currently we are getting out of
memory errors, though these dictionary objects only take 27 meg of
memory, would putting these into Cache would be better from a memory
point of view?
27 MB of memory *per* dictionary, or 27MB of memory *for all* dicionaries?
If it's per dictionary, then it wouldn't take too much to overload a server with
even 4GB+ of RAM (assuming a single sesssion consumes only the 27MB in the
cache, it's roughly 148 sessions to eat 4GB).
That's a lot of memory to consume either way. What are you storing in it?
Chris. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Zombie |
last post by:
Hi, what is the correct way of converting contents of a <string> to
lowercase?
There are no methods of <string> class to do this so I fallback on
strlwr().
But the c_str() method returns a const pointer which cannot be used
with strlwr() as it does the conversion inplace. So, I use the
following logic of copying the contents to a dynamically allocated
char* array and then doing the conversion:
-----------------------------
|
by: Joanna Carter \(TeamB\) |
last post by:
I would like to copy the contents of a Dictionary<string, object> to another
Dictionary<string, object>. Do I have to iterate the source use something
like foreach or is there an easier way ?
Joanna
--
Joanna Carter
Consultant Software Engineer
|
by: Wilson |
last post by:
Hi,
How do get the Dictioanry object from FiedlInfo ?
my code :
fieldInfo = this.GetType().GetField("dictioanry1");
??Dictionary<string, string> dicTemp1 = (Dictionary<string, string>)fieldInfo;
Thanks
Wilson
|
by: buzzweetman |
last post by:
Many times I have a Dictionary<string, SomeTypeand need to get the
list of keys out of it as a List<string>, to pass to a another method
that expects a List<string>.
I often do the following:
<BEGIN CODE>
List<stringkeyNameList = new List<string>();
foreach (string keyName in this.myDictionary.Keys)
|
by: Mark Rae |
last post by:
Hi,
Is it possible to create a case-insensitive List<stringcollection?
E.g.
List<stringMyList = new List<string>;
MyList.Add("MyString");
So that:
| |
by: Mark S. |
last post by:
Hello,
The app in question is lives on a Windows 2003 server with .NET 2.0 running
IIS 6. The page of the app in question processes 2000 get requests a second
during peak loads.
The app uses a Static Object. In this object is a generic List<String>. For
every page request this list is looped over only reading not writing each
value.
|
by: Assimalyst |
last post by:
Hi
I have a Dictionary<string, List<string>>, which i have successfully
filled. My problem is I need to create a filter expression using all
possible permutations of its contents.
i.e. the dictionary essentially creates the following array:
Key Value
|
by: Andy B |
last post by:
Is there a way to databind a checkBoxList to a Dictionary<string, string>
object? If so, how do you do it?
|
by: Andy B |
last post by:
I don't know if this is even working or not but here is the problem. I have
a gridview that I databound to a dictionary<string, stringcollection:
Contract StockContract = new Contract();
StockContract.Dictionary = ContractDictionary<string, string>();
GridView1.DataSource=StockContract.Dictionary;
So far so good. Now I assign something to the Dictionary collection through
some textboxes and a button:
|
by: jandeerit |
last post by:
hi...
can anyone help to show me how to store the array in a dictionary object as shown below?
FROM: Array
: "PARAMETERS"
: "ParamName-1"
: "ParamValue-1"
: "ParamName-2"
: "ParamValue-2"
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |