コード例 #1
0
        /// <summary>
        /// Generates the cache key according to the given cache key parameters.
        /// </summary>
        /// <param name="cacheItemNameParts">Cache key parts which will be used in the generated cache key</param>
        private static string GetCacheKey(params string[] cacheItemNameParts)
        {
            List <string> cacheKeyParts = new List <string>();

            // Set the default cache key prefix. This ensures that the cached data will be site, domain and culture specific.
            cacheKeyParts.Add(SiteContext.CurrentSiteName);
            cacheKeyParts.Add(RequestContext.CurrentDomain);
            cacheKeyParts.Add(LocalizationContext.PreferredCultureCode);

            // Combine cache name keys
            cacheKeyParts.AddRange(cacheItemNameParts);

            return(CacheHelper.BuildCacheItemName(cacheKeyParts));
        }