FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Blog.Core/Blog.Core/Extensions/MemoryCacheSetup.cs at master · githubsunyf/Blog.Core · GitHub
githubsunyf
Blog.Core
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Blog.Core
/
Blog.Core
/
Extensions
/
MemoryCacheSetup.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
25 lines (23 loc) · 732 Bytes
Breadcrumbs
Blog.Core
/
Blog.Core
/
Extensions
/
MemoryCacheSetup.cs
Copy path
File metadata and controls
25 lines (23 loc) · 732 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using
Blog
.
Core
.
Common
.
MemoryCache
;
using
Microsoft
.
Extensions
.
Caching
.
Memory
;
using
Microsoft
.
Extensions
.
DependencyInjection
;
using
System
;
namespace
Blog
.
Core
.
Extensions
{
/// <summary>
/// Cors 启动服务
/// </summary>
public
static
class
MemoryCacheSetup
{
public
static
void
AddMemoryCacheSetup
(
this
IServiceCollection
services
)
{
if
(
services
==
null
)
throw
new
ArgumentNullException
(
nameof
(
services
)
)
;
services
.
AddScoped
<
ICaching
,
MemoryCaching
>
(
)
;
services
.
AddSingleton
<
IMemoryCache
>
(
factory
=>
{
var
cache
=
new
MemoryCache
(
new
MemoryCacheOptions
(
)
)
;
return
cache
;
}
)
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL