DataCacheItemVersion
-
sábado, 25 de abril de 2009 13:44
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
Todas las respuestas
-
sábado, 25 de abril de 2009 16:51
Hi Andrea, can you share your use case with us (I mean the need for a version number)?
Amit. (Velocity Dev, MSFT) -
sábado, 25 de abril de 2009 21:39Hi 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 -
domingo, 26 de abril de 2009 4:47Moderador
Only reason is that it gives us the flexibility to change the internal datatype later if we dont expose the actual version outside.- Marcado como respuesta Murali Krishnaprasad _MK_ - MSFTModerator domingo, 26 de abril de 2009 4:47
-
miércoles, 14 de diciembre de 2011 17:15
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
-
miércoles, 14 de diciembre de 2011 18:32Hi, 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). -
martes, 27 de diciembre de 2011 21:32
Hi,
Can I serialize it to send to client and then deserialize to send to GetIfNewer?
Slava
-
lunes, 09 de enero de 2012 8:05
Can you please describe your scenario/usecase in a bit more detail.
Amit (Dev, AppFabric Caching, MSFT). -
miércoles, 09 de mayo de 2012 2:52
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...

