예제 #1
0
		/// <summary>
		/// Gets the expiration timeout for a given command definition.
		/// </summary>
		/// <param name="cachingCommandDefinition">The command definition.</param>
		/// <param name="slidingExpiration">The sliding expiration time.</param>
		/// <param name="absoluteExpiration">The absolute expiration time.</param>
		protected internal virtual void GetExpirationTimeout(
			CachingCommandDefinition cachingCommandDefinition,
			out TimeSpan slidingExpiration,
			out DateTime absoluteExpiration)
		{
			slidingExpiration = TimeSpan.Zero;
			absoluteExpiration = DateTime.MaxValue;
		}
예제 #2
0
		/// <summary>
		/// Determines whether the specified command definition can be cached.
		/// </summary>
		/// <param name="commandDefinition">The command definition.</param>
		/// <returns>
		/// A value of <c>true</c> if the specified command definition can be cached; otherwise, <c>false</c>.
		/// </returns>
		protected internal override bool CanBeCached(CachingCommandDefinition commandDefinition)
		{
			if (commandDefinition == null)
			{
				throw new ArgumentNullException("commandDefinition");
			}

			// check if we have any non-cacheable tables in the query
			if (NonCacheableTables.Count > 0)
			{
				if (commandDefinition.AffectedEntitySets.Any(esb => NonCacheableTables.Contains(esb.Name)))
				{
					return false;
				}
			}

			// by default everything is cacheable
			return
				CacheableTables.Count == 0 ||
				commandDefinition.AffectedEntitySets.All(esb => CacheableTables.Contains(esb.Name));

			// unless the user has explicitly specified which tables to cache
		}
예제 #3
0
		/// <summary>
		/// Gets the minimum and maximum number cacheable rows for a given command definition.
		/// </summary>
		/// <param name="cachingCommandDefinition">The command definition.</param>
		/// <param name="minCacheableRows">The minimum number of cacheable rows.</param>
		/// <param name="maxCacheableRows">The maximum number of cacheable rows.</param>
		protected internal abstract void GetCacheableRows(
			CachingCommandDefinition cachingCommandDefinition,
			out int minCacheableRows,
			out int maxCacheableRows);
예제 #4
0
		/// <summary>
		/// Determines whether the specified command definition can be cached.
		/// </summary>
		/// <param name="commandDefinition">The command definition.</param>
		/// <returns>
		/// A value of <c>true</c> if the specified command definition can be cached; otherwise, <c>false</c>.
		/// </returns>
		protected internal abstract bool CanBeCached(CachingCommandDefinition commandDefinition);
예제 #5
0
		/// <summary>
		/// Gets the minimum and maximum number cacheable rows for a given command definition.
		/// </summary>
		/// <param name="cachingCommandDefinition">The command definition.</param>
		/// <param name="minCacheableRows">The minimum number of cacheable rows.</param>
		/// <param name="maxCacheableRows">The maximum number of cacheable rows.</param>
		protected internal override void GetCacheableRows(
			CachingCommandDefinition cachingCommandDefinition,
			out int minCacheableRows,
			out int maxCacheableRows)
		{
			minCacheableRows = MinCacheableRows;
			maxCacheableRows = MaxCacheableRows;
		}