public LinkCache(BindingSession session) { int repCount = session.GetValue(SessionParameter.CacheSizeRepositories, CacheSizeRepositories); if (repCount < 1) { repCount = CacheSizeRepositories; } int typeCount = session.GetValue(SessionParameter.CacheSizeTypes, CacheSizeTypes); if (typeCount < 1) { typeCount = CacheSizeTypes; } int objCount = session.GetValue(SessionParameter.CacheSizeLinks, CacheSizeLinks); if (objCount < 1) { objCount = CacheSizeLinks; } string dictionaryLevelName = typeof(DictionaryCacheLevel).FullName; string lruLevelName = typeof(LruCacheLevel).FullName; string contentTypeLevelName = typeof(DictionaryCacheLevel).FullName; linkCache = new Cache("Link Cache"); linkCache.Initialize(new string[] { dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(), // repository lruLevelName + " " + LruCacheLevel.MaxEntries + "=" + objCount.ToString(), // id dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=16", // rel contentTypeLevelName + " " + DictionaryCacheLevel.Capacity + "=3," + DictionaryCacheLevel.SingleValue + "=true" // type }); typeLinkCache = new Cache("Type Link Cache"); typeLinkCache.Initialize(new string[] { dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(), // repository lruLevelName + " " + LruCacheLevel.MaxEntries + "=" + typeCount.ToString(), // id dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=16", // rel contentTypeLevelName + " " + DictionaryCacheLevel.Capacity + "=3," + DictionaryCacheLevel.SingleValue + "=true"// type }); collectionLinkCache = new Cache("Collection Link Cache"); collectionLinkCache.Initialize(new string[] { dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(), // repository dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=8" // collection }); templateCache = new Cache("URI Template Cache"); templateCache.Initialize(new string[] { dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(), // repository dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=6" // type }); repositoryLinkCache = new Cache("Repository Link Cache"); repositoryLinkCache.Initialize(new string[] { dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(), // repository dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=6" // rel }); }
public LinkCache(BindingSession session) { int repCount = session.GetValue(SessionParameter.CacheSizeRepositories, CacheSizeRepositories); if (repCount < 1) { repCount = CacheSizeRepositories; } int typeCount = session.GetValue(SessionParameter.CacheSizeTypes, CacheSizeTypes); if (typeCount < 1) { typeCount = CacheSizeTypes; } int objCount = session.GetValue(SessionParameter.CacheSizeLinks, CacheSizeLinks); if (objCount < 1) { objCount = CacheSizeLinks; } linkCache = new Cache("Link Cache"); linkCache.Initialize(new string[] { typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount, // repository typeof(LruCacheLevel).FullName + " " + LruCacheLevel.MaxEntries + "=" + objCount, // id typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=16", // rel typeof(ContentTypeCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=3," + DictionaryCacheLevel.SingleValue + "=true" // type }); typeLinkCache = new Cache("Type Link Cache"); typeLinkCache.Initialize(new string[] { typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount, // repository typeof(LruCacheLevel).FullName + " " + LruCacheLevel.MaxEntries + "=" + typeCount, // id typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=16", // rel typeof(ContentTypeCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=3," + DictionaryCacheLevel.SingleValue + "=true" // type }); collectionLinkCache = new Cache("Collection Link Cache"); collectionLinkCache.Initialize(new string[] { typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount, // repository typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=8" // collection }); templateCache = new Cache("URI Template Cache"); templateCache.Initialize(new string[] { typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount, // repository typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=6" // type }); repositoryLinkCache = new Cache("Repository Link Cache"); repositoryLinkCache.Initialize(new string[] { typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount, // repository typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=6" // rel }); }
public RepositoryInfoCache(BindingSession session) { int repCount = session.GetValue(SessionParameter.CacheSizeRepositories, CacheSizeRepositories); if (repCount < 1) { repCount = CacheSizeRepositories; } cache = new Cache("Repository Info Cache"); cache.Initialize(new string[] { typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount }); }
public TypeDefinitionCache(BindingSession session) { int repCount = session.GetValue(SessionParameter.CacheSizeRepositories, CacheSizeRepositories); if (repCount < 1) { repCount = CacheSizeRepositories; } int typeCount = session.GetValue(SessionParameter.CacheSizeTypes, CacheSizeTypes); if (typeCount < 1) { typeCount = CacheSizeTypes; } cache = new Cache("Type Definition Cache"); cache.Initialize(new string[] { typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount, // repository typeof(LruCacheLevel).FullName + " " + LruCacheLevel.MaxEntries + "=" + typeCount // type }); }
/// <summary> /// Constructor. /// </summary> public LinkCache(BindingSession session) { int repCount = session.GetValue(SessionParameter.CacheSizeRepositories, SessionParameterDefaults.CacheSizeRepositories); if (repCount < 1) { repCount = SessionParameterDefaults.CacheSizeRepositories; } int typeCount = session.GetValue(SessionParameter.CacheSizeTypes, SessionParameterDefaults.CacheSizeTypes); if (typeCount < 1) { typeCount = SessionParameterDefaults.CacheSizeTypes; } int objCount = session.GetValue(SessionParameter.CacheSizeLinks, SessionParameterDefaults.CacheSizeLinks); if (objCount < 1) { objCount = SessionParameterDefaults.CacheSizeLinks; } string dictionaryLevelName = typeof(DictionaryCacheLevel).FullName; string lruLevelName = typeof(LruCacheLevel).FullName; string contentTypeLevelName = typeof(DictionaryCacheLevel).FullName; linkCache = new Cache("Link Cache"); linkCache.Initialize(new string[] { dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(CultureInfo.InvariantCulture), // repository lruLevelName + " " + LruCacheLevel.MaxEntries + "=" + objCount.ToString(CultureInfo.InvariantCulture), // id dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=16", // rel contentTypeLevelName + " " + DictionaryCacheLevel.Capacity + "=3," + DictionaryCacheLevel.SingleValue + "=true" // type }); typeLinkCache = new Cache("Type Link Cache"); typeLinkCache.Initialize(new string[] { dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(CultureInfo.InvariantCulture), // repository lruLevelName + " " + LruCacheLevel.MaxEntries + "=" + typeCount.ToString(CultureInfo.InvariantCulture), // id dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=16", // rel contentTypeLevelName + " " + DictionaryCacheLevel.Capacity + "=3," + DictionaryCacheLevel.SingleValue + "=true" // type }); collectionLinkCache = new Cache("Collection Link Cache"); collectionLinkCache.Initialize(new string[] { dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(CultureInfo.InvariantCulture), // repository dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=8" // collection }); templateCache = new Cache("URI Template Cache"); templateCache.Initialize(new string[] { dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(CultureInfo.InvariantCulture), // repository dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=6" // type }); repositoryLinkCache = new Cache("Repository Link Cache"); repositoryLinkCache.Initialize(new string[] { dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(CultureInfo.InvariantCulture), // repository dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=6" // rel }); }