Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Distributed Applications / March 2008

Tip: Looking for answers? Try searching our database.

Caching an object client side

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Carl Gilbert - 06 Mar 2008 15:34 GMT
Hi,

I am looking to cache a class in a .NET client/server application on the
client end.  The server holds an instance of the class which is required on
the client at various points.  Currently I have a cached version of the class
in a local member variable on the client.  Updates to the data are not
frequent yet client access to the data is.  The current cache is very basic;
the first time the class is requested it retrieves it from the server,
subsequent calls use the local member, and any update to the data on the
server forces the client to clear its local member so it get refreshed when
next requested.

My class has around 35 private members with public readonly or read/write
properties.  Most properties are primitive (either strings or Booleans),
there are a few simple collections (dictionary string, integer), a few single
properties of a custom class type (class contains a few strings, guids, etc),
and a few lists or dictionaries using custom classes (generic.dictionary(of
guid, generic.dictionary(of guid, ivariable))).  Nothing too complex.

Caching the object on the client still seems to present a performance impact
when accessing a property on the object.  Even though it is cached locally it
seems to be making a trip back to the server as anything could by within the
Get of one of the properties.

How can I truly cache the object?  I started reading up about the Microsoft
Caching Application Block but feel this could be a bit overkill.  Would the
best solution be to create another custom class (held on the client) that
contains its own local members and exposes public functions or properties to
access the members?  Or could I create some sort of generic collection of
cached members, keyed by the name of the property, and write a wrapper class
to maintain and access this list?

Regards, Carl Gilbert
Mufaka - 06 Mar 2008 17:02 GMT
> Hi,
>
[quoted text clipped - 29 lines]
>
> Regards, Carl Gilbert
I've used System.Web.HttpRuntime.Cache in windows services and desktop
applications without a problem.
Roy Lawson - 29 Mar 2008 15:33 GMT
One solution is to create a common interface that both classes implement.  
That is probably the best solution in this case.

So yes, you would create two different classes on the client/server but both
classes would implement the same interface.  You can put that interface in
common code that both projects reference.

Hope that helps.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.