<commit_before>using System.Collections.Generic;
using Microsoft.ApplicationServer.Caching;
using NHibernate.Cache;
using System;

namespace Orchard.Azure.Services.Caching.Database {

    public class AzureCacheProvider : ICacheProvider {

        private DataCache _dataCache;
        private bool _sharedCaching;

        public ICache BuildCache(string regionName, IDictionary<string, string> properties) {
            
            if (_dataCache == null) {
                throw new ApplicationException("DataCache should be available");
            }
            
            string enableCompressionString;
            properties.TryGetValue("compression_enabled", out enableCompressionString);

            
            TimeSpan? expiration = null;
            string expirationString;
            if (properties.TryGetValue("expiration", out expirationString) || properties.TryGetValue(NHibernate.Cfg.Environment.CacheDefaultExpiration, out expirationString)) {
                expiration = TimeSpan.FromSeconds(Int32.Parse(expirationString));
            }

            return new AzureCacheClient(_dataCache, _sharedCaching, regionName, expiration);
        }

        public long NextTimestamp() {
            return Timestamper.Next();
        }

        public void Start(IDictionary<string, string> properties) {
            CacheClientConfiguration configuration;

            try {
                var tenant = properties["region_prefix"];

                configuration = CacheClientConfiguration.FromPlatformConfiguration(tenant, Constants.DatabaseCacheSettingNamePrefix);
                configuration.Validate();
            }
            catch (Exception ex) {
                throw new Exception(String.Format("The {0} configuration settings are missing or invalid.", Constants.DatabaseCacheFeatureName), ex);
            }

            _dataCache = configuration.CreateCache();
            _sharedCaching = configuration.IsSharedCaching;
        }

        public void Stop() {
        }
    }
}<commit_msg>Fixing azure caching property bag strings<commit_after>using System.Collections.Generic;
using Microsoft.ApplicationServer.Caching;
using NHibernate.Cache;
using System;

namespace Orchard.Azure.Services.Caching.Database {

    public class AzureCacheProvider : ICacheProvider {

        private DataCache _dataCache;
        private bool _sharedCaching;

        public ICache BuildCache(string regionName, IDictionary<string, string> properties) {
            
            if (_dataCache == null) {
                throw new ApplicationException("DataCache should be available");
            }
            
            string enableCompressionString;
            properties.TryGetValue("compression_enabled", out enableCompressionString);

            
            TimeSpan? expiration = null;
            string expirationString;
            if (properties.TryGetValue(NHibernate.Cfg.Environment.CacheDefaultExpiration, out expirationString) || properties.TryGetValue("cache.default_expiration", out expirationString)) {
                expiration = TimeSpan.FromSeconds(Int32.Parse(expirationString));
            }

            return new AzureCacheClient(_dataCache, _sharedCaching, regionName, expiration);
        }

        public long NextTimestamp() {
            return Timestamper.Next();
        }

        public void Start(IDictionary<string, string> properties) {
            CacheClientConfiguration configuration;

            try {
                var tenant = properties["cache.region_prefix"];

                configuration = CacheClientConfiguration.FromPlatformConfiguration(tenant, Constants.DatabaseCacheSettingNamePrefix);
                configuration.Validate();
            }
            catch (Exception ex) {
                throw new Exception(String.Format("The {0} configuration settings are missing or invalid.", Constants.DatabaseCacheFeatureName), ex);
            }

            _dataCache = configuration.CreateCache();
            _sharedCaching = configuration.IsSharedCaching;
        }

        public void Stop() {
        }
    }
}
{'fraction_non_alphanumeric': 0.07254623044096728, 'fraction_numerical': 0.001422475106685633, 'mean_word_length': 2.2206106870229005, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3320342', 'n_tokens_mistral': 985, 'n_tokens_neox': 906, 'n_words': 211}