mirror of
https://github.com/bitwarden/server
synced 2026-01-06 10:34:01 +00:00
configurable cache size limit
This commit is contained in:
@@ -18,10 +18,24 @@ namespace Bit.Icons
|
||||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
// Options
|
||||
services.AddOptions();
|
||||
services.Configure<IconsSettings>(Configuration.GetSection("IconsSettings"));
|
||||
services.AddMemoryCache();
|
||||
|
||||
// Settings
|
||||
var iconsSettings = new IconsSettings();
|
||||
ConfigurationBinder.Bind(Configuration.GetSection("IconsSettings"), iconsSettings);
|
||||
services.AddSingleton(s => iconsSettings);
|
||||
|
||||
// Cache
|
||||
services.AddMemoryCache(options =>
|
||||
{
|
||||
options.SizeLimit = iconsSettings.CacheSizeLimit;
|
||||
});
|
||||
|
||||
// Services
|
||||
services.AddSingleton<IDomainMappingService, DomainMappingService>();
|
||||
|
||||
// Mvc
|
||||
services.AddMvc();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user