Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ASP.NET Core (.NET 6) Web API + cache (Redis, Memory)

NotificationsYou must be signed in to change notification settings

jmbl1685/aspnet-core-net-6-api-cache

Repository files navigation

To run this project from Docker

$> docker build -t aspnet-core-net-6-api-cache -f ./CacheSample.WebApi/Dockerfile.$> docker create --name aspnet-core-net-6-api-cache-core aspnet-core-net-6-api-cache$> docker start aspnet-core-net-6-api-cache-core$> docker run --rm -p 3000:3000 aspnet-core-net-6-api-cache

Solution sample to (port is already allocated)

Bind for 0.0.0.0:3000 failed: port is already allocated.$> docker psCONTAINER ID   IMAGE                         COMMAND                  CREATED          STATUS          PORTS                    NAMES69e65c95dfaf   aspnet-core-net-6-api-cache   "dotnet CacheSample.…"   35 seconds ago   Up 29 seconds                            aspnet-core-net-6-api-cache-core$> docker stop 69e65c95dfaf$> docker ps CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES$> docker run --rm -p 3000:3000 aspnet-core-net-6-api-cacheinfo: Microsoft.Hosting.Lifetime[14]      Now listening on: http://[::]:3000info: Microsoft.Hosting.Lifetime[0]      Application started. Press Ctrl+C to shut down.info: Microsoft.Hosting.Lifetime[0]      Hosting environment: Productioninfo: Microsoft.Hosting.Lifetime[0]      Content root path: /app/

Using Memory

image

Using Redis

image

You can add your custom DB Provider (MongoDB, SQL Server, PostgreSQL, etc) and adapt it as necessary

Go to the file "appsettings.json" (aspnet-core-net-6-api-cache/CacheSample.WebApi/appsettings.json) and replace your redis connection string

{  "Logging": {    "LogLevel": {      "Default": "Information",      "Microsoft.AspNetCore": "Warning"    }  },  "AllowedHosts": "*",  "Redis": {    "ConnectionString": "your_host:your_port,password=your_password"  }}

Screenshots:

image

image

Result:

image

About

ASP.NET Core (.NET 6) Web API + cache (Redis, Memory)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp