473,699 Members | 2,248 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Caching in web services

Hi,
I have a series of web services. They all use require authentication and
successful authentication instantiates a Customer object which is used for
billing purposes. All of this is handled by a common base class. I'd like to
cache these Customer objects so that I don't have to make a database call
each time the service is called but I'm not sure of the best strategy. The
System.Web.Cach ing.Cache object seems to provide the required functionality.
It's very easy to use from a regular .aspx page but I'm not sure how to
implement equivalent functionality in my base class.

Please could you recommend an approach?

Regards,

Lee
Feb 28 '06 #1
2 4262
"beaverme" <be******@newsg roups.nospam> wrote in message
news:1A******** *************** ***********@mic rosoft.com...
Hi,
I have a series of web services. They all use require authentication and
successful authentication instantiates a Customer object which is used for
billing purposes. All of this is handled by a common base class. I'd like
to
cache these Customer objects so that I don't have to make a database call
each time the service is called but I'm not sure of the best strategy. The
System.Web.Cach ing.Cache object seems to provide the required
functionality.
It's very easy to use from a regular .aspx page but I'm not sure how to
implement equivalent functionality in my base class.


So you need to call the web services from ASP.NET application. Is that
correct?
I think System.Web.Cach ing.Cache will not be a good choice since it is a
global object and it seems you need per session object . Also Cache object
expires when the there is a need for more memory, so you should check it for
null every single time you use it.
May be you should consider Session object in ASP.NET. It is per user
(session) and make sure that you implement a scale strategy in case your
logical design requires it.

HTH,

--
Martin Kulov
http://www.codeattest.com/blogs/martin

MCT
MCSD.NET Early Achiever


Feb 28 '06 #2
Hi Lee,

If the data object is used at webservice server-side and will be frequently
accessed after the first time it is created, I think it is reasonable to
cache it. And as for how to cache it , we have several approachs:

1. Use SessionState, this is possible for ASP.NET webserivce and will help
us store the data object per client user session. However, there're some
setting we need to pay attention, see the following MSDN article:

#Using ASP.NET Session State in a Web Service
http://msdn.microsoft.com/library/en...08062002.asp?f
rame=true

Also, for session state data, there is no expiration policy we can use, we
need to manually clear it after finishing use them or let them expire when
session timeout.

2. Use Application Cache, I prefer this approach since the ASP.NET
System.Web.Cach e provide rich functionality such as cache dependency
supports so that we can make the cached object automatically expire when
some certain dependency changes. Also. in 2.0 there comes the new Sql
Database cache dependency which is rather powerful. However, since Cache
is application scope storage, we need to manually use our own index to
separate data for individual client user.

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Mar 1 '06 #3

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

Similar topics

0
1033
by: Keith Naas | last post by:
At my company, we are using a DNS server to load balance between two production WebLogic servers that host web services. These web services are being consumed by a vb dotnet client. When using "http", you can see each request going to a different WebLogic server. However, when using "https", it appears that dotnet is caching the IP address of the first server it finds and using that until the application is restarted. We've scoured...
8
2119
by: Nick Gilbert | last post by:
Hi, Our development web server (Win 2003 Server) seems to be caching the output of various files (CSS and .aspx files) if they have no query string. The moment you put a question mark in the URL, it's fine. The problem is that if you modify a file, it still shows you the old file unless you restart the website or IIS itself. It's definitely not the browser that's caching the files - IIS is actually serving the wrong file.
3
1928
by: Jack | last post by:
Is anyone able to get output caching to work on web services? I have followed KB 318299 which involves adding a method like the one below and calling twice within a short period of time. The second execution should use the result from the cache of first execution, but does not and executes the method a second time. public string CacheTest() { StringBuilder sb = new StringBuilder( "Method executed at " );...
5
298
by: michaeltorus | last post by:
Is the only way to cache data in Memory, such as a Dom Document, to use System.Web.Caching namespace? I can't seem to find anything else, but what if you want to cache something in memory and you don't have a web app ? --- Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
5
2020
by: ask ksa | last post by:
hi, is anybody familiar with production-ready distributed/clustered cache solution for .net ? Google helped me to found some (like ncache and scale-out-state-server), but they are over-priced thanks anyway for your time reading that
4
2182
by: Henrik Dahl | last post by:
Hello! In my application I have a need for using a regular expression now and then. Often the same regular expression must be used multiple times. For performance reasons I use the RegexOptions.Compiled when I instantiate it. It must be obvious that it takes some time to instantiate such an object. My question is, does the Regex instantiation somehow deal with some caching internally so instantiating a Regex object multiple times...
0
889
by: siddu | last post by:
Hi, My page is displaying 5 reports I am using VisualStudio 2005 and SQLSERVER 2005. I am displaying reports using reporting Services In my page reports are generating very slow. I would like to go for caching in Reporting Services please give a good guidence on this experiment Thanks
12
2069
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I'm using ASP.Net with an UpdatePanel. When the screen is exercised via a Web Test, the Web Test shows that the AJAX scripts are downloaded for every partial post back. My impression was that IE would cache these scripts so that the AJAX script download would only occur once. What am I missing?
2
1833
by: Ken Fine | last post by:
I have a question about ASP.NET output caching. I want to use screen scraping as a temporary hack to pull in some complex Classic ASP-rendered content into some ASP.NET pages: protected String ReadHtmlPage(string url) { WebResponse objResponse; WebRequest objRequest = System.Net.HttpWebRequest.Create(url); objResponse = objRequest.GetResponse();
0
8618
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,...
0
9035
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...
1
8916
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,...
0
7752
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
5875
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4376
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
4631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2348
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2010
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.