473,671 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

disadvantages of singleton model for caching?

I'm creating a new C# app to mirror a legacy ASP app. I've created a data
access layer (DAL) which uses the singleton model to "emulate" the old
Application Variable caching except as a stand-alone DLL - it only reads
from the database infrequently changing information once a day.

Can anyone tell me if there will be a performance/usage penalty to using it
for my entire DAL? Or should I only be using the Singleton-model DAL class
for my "cached" information?

Thanks in advance,

Duncan
Nov 16 '05 #1
1 5077
Duncan,

You shouldn't see a performance penalty, as long as your app is running
in one application domain (which it should be).

My only suggestion is that you make sure that calls to it are
thread-safe, using the lock statement to lock critical sections of code.

If you are going to have a high volume of reads to writes, then you
might want to look at the ReaderWriterLoc k class, which can manage this for
you, in a more efficient manner.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Duncan Welch" <du**@ntpcl.f9. co.uk> wrote in message
news:uY******** ******@TK2MSFTN GP10.phx.gbl...
I'm creating a new C# app to mirror a legacy ASP app. I've created a data
access layer (DAL) which uses the singleton model to "emulate" the old
Application Variable caching except as a stand-alone DLL - it only reads
from the database infrequently changing information once a day.

Can anyone tell me if there will be a performance/usage penalty to using it for my entire DAL? Or should I only be using the Singleton-model DAL class for my "cached" information?

Thanks in advance,

Duncan

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
3208
by: lawrence | last post by:
To call I would do something like: $headline = McSelectJustOneField::callDatastore("cbHeadline"); Is this the correct use of the static keyword, to implement a Singleton design?
26
2489
by: Uwe Mayer | last post by:
Hi, I've been looking into ways of creating singleton objects. With Python2.3 I usually used a module-level variable and a factory function to implement singleton objects. With Python2.4 I was looking into decorators. The examples from PEP 318 http://www.python.org/peps/pep-0318.html#examples don't work - AFAIK because:
16
6721
by: cppaddict | last post by:
Hi, In this tutorial on singleton class in C++ (http://gethelp.devx.com/techtips/cpp_pro/10min/10min0200.asp) the author gives two implementations of a simple singleton class, claiming that only the first is safe for multi-threaded appliactions. I want to know why this so. The class is as follows:
5
2246
by: clintonG | last post by:
I'm looking for documentation and would not turn my nose up to any code from anybody who thinks they are good at the design of an algorythm that can be used to generated a hierarchical relational data model. What? A Yahoo-like drill-down menu that is a series of categories and nested categories is a hierarchical relational data model. An example can be seen at but the review of the query string values strongly indicates
5
3979
by: Bob | last post by:
Does anyone know of any adverse affects of using singleton data access objects in an ASP.NET Web Service? I've been forced to implement it this way but it just doesn't seem right to me. I haven't been able to find a single example of someone doing it this way and that's usually not a good sign. I'm afraid that there may be subtle problems that won't show up quickly because the production environment will not be hitting the web service at...
12
2445
by: solex | last post by:
Hello, I am trying to model a session object that is essentially a collection of different items (connection string, user name, maps etc.) I would like this session object to be available to other objects within my client application. I can do one of two things (1) make the session object a singleton (2) pass the session object to the methods that need them. Option 2 is a bit more complicated and messy then option 1. My other goal...
4
2026
by: a | last post by:
Hello Gang, I am in a bit of confusion regarding a half completed application I am writing. It is an MDI app, so I have a main form (frmMain) that is always open. I am looking for a 'Best Practice' here. I have a class (config.vb) that manages an XML file with the applications configuration settings. I need to access it from many places in the app. I have other similar classes (onlineOffline.vb, dataAccess.vb, etc.) I only need...
54
6424
by: m.roello | last post by:
In the book: "Working with Microsoft Visual Studio 2005" Craig Skibo wrote: "The power of Visual Studio 2005 lies in its ability to empower users to build, test, and debug powerful applications quickly and easly." I don't agree on what concernes ASP .NET Web Sites in VS2005. All what involves Namespaces in Web sites has been disappeared. I know you can still MANUALLY manage them, but not QUICKLY and EASLY. In a
7
2237
by: fredd00 | last post by:
Hi I'm just starting with singleton and would like to implement in my new web app. I have a question lets say i create a singleton DataHelper that holds a static SqlConnection object to share and on my page I do
0
8474
marktang
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...
0
8912
Oralloy
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...
0
8819
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8669
tracyyun
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...
0
7428
agi2029
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...
0
4222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4403
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2049
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1807
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.