NCache 4.6 - Online Documentation

Saving Item Version for the First Time

 
An Add operation returns CacheItemVersion. If the item is added for the first time ‘1’ is returned. This version will be used  in future operations on this key.  In this example, custom data with key “Product:1001” is added in the cache and its item version is saved. However, it should be ensured that the object is either .NET serialized or registered with NCache Compact Serialization Framework.
      To utilize the API, include the following namespace in your application: Alachisoft.NCache.Web.Caching.
 
    Product product = new Product();
            product.ProductID = 1001;
            product.ProductName = "Chai";
 
            string key = "Product:" + product.ProductID;
 
            try
            {
                CacheItemVersion itemVersion = cache.Add(key, product);
                //Save this item Version for future utilization 
            }
            catch (OperationFailedException ex)
            {
                // handle exception
            }
 
 
See Also