Skip to content

Commit

Permalink
added sql server cache
Browse files Browse the repository at this point in the history
  • Loading branch information
rushi committed Sep 11, 2017
1 parent 18c456e commit 1d4ed9e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Trappist/src/Promact.Trappist.Web/Promact.Trappist.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.SqlServer" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.1" />
Expand Down Expand Up @@ -70,6 +71,7 @@
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.Caching.SqlConfig.Tools" Version="1.0.0-msbuild3-final" />
</ItemGroup>

</Project>
7 changes: 7 additions & 0 deletions Trappist/src/Promact.Trappist.Web/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ public void ConfigureServices(IServiceCollection services)
services.AddMiniProfiler().AddEntityFramework();

services.AddMemoryCache();

services.AddDistributedSqlServerCache(options =>
{
options.ConnectionString = Configuration.GetSection("ConnectionStrings:DefaultConnection").Value;
options.SchemaName = "dbo";
options.TableName = "Cache";
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, TrappistDbContext context, ConnectionString connectionString, IMemoryCache cache)
Expand Down

0 comments on commit 1d4ed9e

Please sign in to comment.