NCache 4.4 - Online Documentation

Class Versioning (Same Platform)

 
In a distributed environment, multiple applications are connected with cache. Let’s say client applications need to be upgraded. Now all the applications can’t be upgraded at the same time. Meanwhile if some classes get upgraded in some applications, how can they share data with other old ones?  Here comes the concept of Class Versioning.
 
If a class is serializable and the objects of the class are written to a data source and then later they are read back in, the versions of the objects that were written and read must be the same. If the object of one version of the class is saved in the database and later on that class is changed (new version), then a read operation will read the old version from database.
 
NCache provides the feature of Class Versioning Compatibility for the same platform. This class versioning feature can be used by configuring it through administrative NCache Data Sharing Tool and providing mapping for attributes with target class.
 
Class Attributes Mapping
ProductV2 Class (C#)
ProductV1 Class (C#)
ID
ID
name
name
price
price
quantity
quantity
Discount
 
 
 
In above mentioned table, the attributes of class have been mapped with each other, discount is a new attribute added in product class so it is left unmapped.
 
Mapping ProductV2 with ProductV1will allow storing ProductV2 and getting it in ProductV1 and vice versa.
 
NCache uses compact serialization and creates dynamic serialization code for both classes for compatibility and as a result, reduces size of data and boosts performance of client applications.
 
 
See Also