Ejemplo n.º 1
0
        public void Constructor_SetsKeyAndValue()
        {
            var value = new byte[1];
            var sot   = new MongoCacheItem("MyKey", value, new DistributedCacheEntryOptions());

            Assert.Equal("MyKey", sot.Key);
            Assert.Equal(value, sot.Value);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Add an item to the cache
        /// </summary>
        /// <param name="key">Key of the cache item</param>
        /// <param name="item">Item to add to cache</param>
        public override void Add(string key, object item)
        {
            var cacheItem = new MongoCacheItem
            {
                Key     = this.Prefix(key),
                Item    = item,
                IsDirty = false
            };

            this.mongoProvider.DefaultCollection.Save(cacheItem);
        }
 public void Put(UrlRequest request, Response response)
 {
     var cacheItem = new MongoCacheItem(request.CacheKey, request.Url, response);
     _collection.Insert(cacheItem, SafeMode.False);
 }