Ejemplo n.º 1
0
		/// <summary>
		/// Sets the specified key.
		/// </summary>
		/// <param name="key">The key.</param>
		/// <param name="value">The value.</param>
		/// <param name="itemInfo">Pass NULL if want to use default
		/// values.</param>
		public void Set(
			string key,
			object value,
			CacheItemInformation itemInfo )
		{
			lock ( thisLock )
			{
				OnBeforeValueSet();

				inMemoryCache[key] =
					new SimpleCacheItemInformation(
					key,
					value,
					itemInfo );

				LogCentral.Current.LogDebug(
					string.Format(
					@"[Cache] Added cache item at '{0}' with: " +
					@"key = '{1}', value = '{2}'.",
					DateTime.Now,
					key,
					inMemoryCache[key].Dump() ) );

				OnAfterValueSet();
			}
		}
Ejemplo n.º 2
0
			/// <summary>
			/// Constructor.
			/// </summary>
			/// <param name="key">The key.</param>
			/// <param name="value">The value.</param>
			/// <param name="cacheInfo">The cache info.</param>
			public SimpleCacheItemInformation(
				string key,
				object value,
				CacheItemInformation cacheInfo )
			{
				this.key = key;
				this.value = value;
				this.cacheInfo = cacheInfo;
			}
Ejemplo n.º 3
0
		/// <summary>
		/// Write to the cache.
		/// </summary>
		/// <param name="key">The key.</param>
		/// <param name="value">The value.</param>
		/// <param name="itemInfo">The item info.</param>
		public virtual void Set(
			string key,
			object value,
			CacheItemInformation itemInfo )
		{
			lock ( thisLock )
			{
				if ( backend != null )
				{
					backend.Set( key, value, itemInfo );
				}
			}
		}