NCache 4.6 - Online Documentation

Adding or Updating Data with Streams

The same method is used for adding and updating the data within a stream. If the key provided with GetCacheStream API does not exist in the cache, the data written on the stream is added to the cache. If an item already exists in the cache with the provided key, binary data written on the stream is appended with the existing data against the specified key.
      To utilize the API, include the following namespace in your application: Alachisoft.NCache.Web.Caching. 
            string key = "key:ncache-manual";
            byte[] dataToWrite = System.IO.File.ReadAllBytes("C:\\ncache-manual.pdf");
                cacheStream = cache.GetCacheStream(key, StreamMode.Write);
                cacheStream.Write(dataToWrite, 0, dataToWrite.Length);
                //...Close stream
            catch (StreamException ex)
                // handle exception
See Also