1 // Copyright 2004-2007 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
.Internal
17 using Castle
.MonoRail
.Framework
;
18 using Castle
.MonoRail
.Framework
.ViewComponents
;
21 /// Represents a <see cref="ViewComponent"/> cache configuration.
23 public class ViewComponentDescriptor
26 /// Represents an empty descriptor
28 public static readonly ViewComponentDescriptor Empty
= new ViewComponentDescriptor(false, ViewComponentCache
.Disabled
, null);
30 private readonly bool isCacheable
;
31 private readonly ViewComponentCache cacheStrategy
;
32 private readonly IViewComponentCacheKeyGenerator cacheKeyGenerator
;
35 /// Initializes a new instance of the <see cref="ViewComponentDescriptor"/> class.
37 /// <param name="isCacheable">if set to <c>true</c> [is cacheable].</param>
38 /// <param name="cacheStrategy">The cache strategy.</param>
39 /// <param name="cacheKeyGenerator">The cache key generator.</param>
40 public ViewComponentDescriptor(bool isCacheable
, ViewComponentCache cacheStrategy
, IViewComponentCacheKeyGenerator cacheKeyGenerator
)
42 this.isCacheable
= isCacheable
;
43 this.cacheStrategy
= cacheStrategy
;
44 this.cacheKeyGenerator
= cacheKeyGenerator
;
48 /// Gets a value indicating whether the view component is cacheable.
51 /// <c>true</c> if the View Component is cacheable; otherwise, <c>false</c>.
53 public bool IsCacheable
55 get { return isCacheable; }
59 /// Gets the cache strategy.
61 /// <value>The cache strategy.</value>
62 public ViewComponentCache CacheStrategy
64 get { return cacheStrategy; }
68 /// Gets the cache key generator.
70 /// <value>The cache key generator.</value>
71 public IViewComponentCacheKeyGenerator CacheKeyGenerator
73 get { return cacheKeyGenerator; }