Skip to content

RidvanOzturk/InMemoryCacheExample

Repository files navigation

In Memory Cache Example

InMemoryCacheExample is a Web API project developed on the .NET 9 platform. This project demonstrates how to optimize database access by integrating Dapper for fast queries and IMemoryCache for caching frequently accessed data. It applies a clean, layered architecture and the cache-aside pattern to improve performance when handling a high number of database records.

Technologies Used

  • .NET 9 (ASP.NET Core Web API): Main framework of the project.
  • Dapper ORM: Lightweight data access for SQL Server.
  • Microsoft SQL Server: Storing user data.
  • IMemoryCache: In-memory caching for rapid data retrieval.

Setup

Running Locally

  • Install Visual Studio Code or Visual Studio 2022 or any suitable IDE.

  • Install .NET 9 SDK.

  • Set up a SQL Server database and use

    • CREATE TABLE Users (
      Id INT PRIMARY KEY IDENTITY,
      Username NVARCHAR(100),
      Fullname NVARCHAR(150)
      );
      SET NOCOUNT ON;
      DECLARE @i INT = 1;
      WHILE @i <= 1000000
      BEGIN
      INSERT INTO Users (Username, Fullname)
      VALUES (CONCAT('user', @i), CONCAT('Fullname ', @i));
      SET @i = @i + 1;
      END
      
  • Clone the Repository:

    • git clone https://github.com/RidvanOzturk/InMemoryCacheExample.git
  • Run project through IDE.



About

InMemoryCacheExample is a Web API project developed on the .NET 9 platform. This project demonstrates how to optimize database access by integrating Dapper for fast queries and IMemoryCache for caching frequently accessed data.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors