DataCacheItemVersion
-
Saturday, April 25, 2009 1:44 PM
Hi,
after some tests with optimistic lock feature, my question is about the choice to mark version number as internal:
why isn't available as a public readonly property? I mean just the version number.internal InternalCacheItemVersion InternalVersion { get ; set ; }
Thanks
Andrea Colaci
Answers
-
Sunday, April 26, 2009 4:47 AMModerator
Only reason is that it gives us the flexibility to change the internal datatype later if we dont expose the actual version outside.- Marked As Answer by Murali Krishnaprasad _MK_ - MSFTModerator Sunday, April 26, 2009 4:47 AM
All Replies
-
Saturday, April 25, 2009 4:51 PM
Hi Andrea, can you share your use case with us (I mean the need for a version number)?
Amit. (Velocity Dev, MSFT) -
Saturday, April 25, 2009 9:39 PMHi Amit,
at moment there isn't a specific need for a version number (a demo aside), I was just wondering why DataCacheItemVersion is an instance that only needs to be passed around during optimistic GETs and PUTs and does not expose any public members like version number.
Thanks
Andrea Colaci -
Sunday, April 26, 2009 4:47 AMModerator
Only reason is that it gives us the flexibility to change the internal datatype later if we dont expose the actual version outside.- Marked As Answer by Murali Krishnaprasad _MK_ - MSFTModerator Sunday, April 26, 2009 4:47 AM
-
Wednesday, December 14, 2011 5:15 PM
Hi Amit,
In our scenario we have "long-running" background task which calculates result object and store it to cache and client Ajax page which is continuously polling stateless web-server to get updates from cache and display calculated partial results to users.
What I want is when new ajax request is received, check if version in cache is changed and if not, say back to client that it has latest version.
Having version number I could send it among with object to client which in turn could send it among with request for update back to web-server.
Currently we have to implement our own version number inside an object. The problem with this approach is that web-server has to get full object from cache just to compare versions and can't use GetIfNewer.
Best,
Slava
-
Wednesday, December 14, 2011 6:32 PMHi, DataCacheItemVersion has equality, inequality, greater than, less than operators overloaded which can be used to compare the versions. You don't actually need the internal version number for that.
Amit (Dev, AppFabric Caching). -
Tuesday, December 27, 2011 9:32 PM
Hi,
Can I serialize it to send to client and then deserialize to send to GetIfNewer?
Slava
-
Monday, January 09, 2012 8:05 AM
Can you please describe your scenario/usecase in a bit more detail.
Amit (Dev, AppFabric Caching, MSFT). -
Wednesday, May 09, 2012 2:52 AM
Think any scenario in which the DataCacheItemVersion cannot be stored in local memory and thus must be serialized so it can be transmitted across some medium.
Scenarios
Asp.net web page loads data from cache on original load, on postback would like to update cache object only if cache object is the same version as it was when the page was originally loaded, in order to have the original DataCacheItemVersion on hand during postback the DataCacheItemVersion object would need to be serialized to html when the page is originally rendered and deserialized from html during postback.
WCF client retrieves large amount of data from WCF endpoint and sometime later would like to poll to be sure it still has the most recent data... ideally DataCacheItemVersion could be serialized and sent across the wire along with the data so when the client polls the small DataCacheItemVersion object is all that needs be sent.
Ajax client hits webservice method...

