private void SetItem(string name, object value)
        {
            var fullKey = keyPrefix + name;

            if (namedCache.Contains(fullKey))
            {
                namedCache.Insert(fullKey, value, createPolicy, true, false);
            }
            else
            {
                namedCache.Insert(fullKey, value, createPolicy, true, true);
                IncrementCount(1);

                var metadata = new ObjectMetadata();
                metadata.IndexCollection[KeyPrefixIndex] = keyPrefixIndexValue;

                namedCache.SetMetadata(fullKey, metadata, true);
            }

            IncrementVersion();
        }
示例#2
0
 /// <summary>
 /// Determines whether the <b>IDictionary</b> contains an element
 /// with the specified key.
 /// </summary>
 /// <returns>
 /// <b>true</b> if the <b>IDictionary</b> contains an element with
 /// the key; otherwise, <b>false</b>.
 /// </returns>
 /// <param name="key">
 /// The key to locate in the <b>IDictionary</b>.
 /// </param>
 public virtual bool Contains(object key)
 {
     return(NamedCache.Contains(key));
 }