1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.MonoRail
.Framework
.Descriptors
17 using Castle
.MonoRail
.Framework
;
20 /// Represents a <see cref="ViewComponent"/> cache configuration.
22 public class ViewComponentDescriptor
25 /// Represents an empty descriptor
27 public static readonly ViewComponentDescriptor Empty
= new ViewComponentDescriptor(false, ViewComponentCache
.Disabled
, null);
29 private readonly bool isCacheable
;
30 private readonly ViewComponentCache cacheStrategy
;
31 private readonly IViewComponentCacheKeyGenerator cacheKeyGenerator
;
34 /// Initializes a new instance of the <see cref="ViewComponentDescriptor"/> class.
36 /// <param name="isCacheable">if set to <c>true</c> [is cacheable].</param>
37 /// <param name="cacheStrategy">The cache strategy.</param>
38 /// <param name="cacheKeyGenerator">The cache key generator.</param>
39 public ViewComponentDescriptor(bool isCacheable
, ViewComponentCache cacheStrategy
, IViewComponentCacheKeyGenerator cacheKeyGenerator
)
41 this.isCacheable
= isCacheable
;
42 this.cacheStrategy
= cacheStrategy
;
43 this.cacheKeyGenerator
= cacheKeyGenerator
;
47 /// Gets a value indicating whether the view component is cacheable.
50 /// <c>true</c> if the View Component is cacheable; otherwise, <c>false</c>.
52 public bool IsCacheable
54 get { return isCacheable; }
58 /// Gets the cache strategy.
60 /// <value>The cache strategy.</value>
61 public ViewComponentCache CacheStrategy
63 get { return cacheStrategy; }
67 /// Gets the cache key generator.
69 /// <value>The cache key generator.</value>
70 public IViewComponentCacheKeyGenerator CacheKeyGenerator
72 get { return cacheKeyGenerator; }