34 lines
845 B
C#
34 lines
845 B
C#
namespace Kit.Helpers.Cache
|
|
{
|
|
using System;
|
|
public class CacheParameter : ICacheParameter
|
|
{
|
|
public string Key { get; }
|
|
public CacheParameter(CacheLevels mode, string key)
|
|
{
|
|
Check.StringArgumentIsNotNullOrEmpty(key, "Key");
|
|
this.CachingLevel = mode;
|
|
this.Key = key ?? String.Empty;
|
|
}
|
|
|
|
#region ICacheParameter Members
|
|
|
|
public CacheLevels CachingLevel { get; }
|
|
|
|
public string GetCacheKey(CacheLevels cachingMode)
|
|
{
|
|
return this.IsCache(cachingMode) ? this.Key : string.Empty;
|
|
}
|
|
|
|
public bool IsCache(CacheLevels cachingLevel)
|
|
{
|
|
if (this.CachingLevel == cachingLevel)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |