Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Thu, 6 Mar 2008 07:34:00 -0800,    group: microsoft.public.dotnet.distributed_apps        back       


Caching an object client side   
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
date: Thu, 6 Mar 2008 07:34:00 -0800   author:   Carl Gilbert

Re: Caching an object client side   
Carl Gilbert wrote:
> 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
I've used System.Web.HttpRuntime.Cache in windows services and desktop 
applications without a problem.
date: Thu, 06 Mar 2008 09:02:25 -0800   author:   Mufaka

RE: Caching an object client side   
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.
date: Sat, 29 Mar 2008 07:33:00 -0700   author:   Roy Lawson

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us