Skip to content

Implemented Microsoft.Extensions.Caching.Abstractions using Dapr's state store.

License

Notifications You must be signed in to change notification settings

TonWin618/Caching-Dapr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TonWinPkg.Extensions.Caching.Dapr

Introduction

This package serves as an implementation of Microsoft.Extension.Caching.Abstractions, providing caching functionality through Dapr's state store component.

Warning

It is advised to consider this package solely as a transitional solution for the following reasons:

  1. Dapr's state management building block does not implement sliding expiration time. The sliding expiration time implemented by this package is achieved by adding fields to the cached values. Thus, you need to ensure that all read and write operations on the cache are handled through this library.
  2. Dapr only supports caching data in JSON format and does not support byte arrays. Therefore, this package utilizes Base64 decoding and encoding when reading and writing cache data, resulting in unnecessary performance overhead.

Recommendation

It is recommended to use this library only for feasibility testing of integrating your project with Dapr and not advisable for use in production environments. If you intend to use Dapr for caching operations in a production environment, it is recommended not to use Microsoft.Extensions.Caching.Abstractions.

Running Tests

Before running, make sure you have initialized Dapr and your state store component is named statestore.

Run the following command in the test directory:

dapr run --app-id myapp --dapr-http-port 3500 dotnet test

Performance Comparison

performance_comparison

Note: n*m represents n threads, each simultaneously looping through m operations. Each operation consists of one set, one get, and one remove. Each data item is 10kb.

Dapr Implementation:https://www.nuget.org/packages/TonWinPkg.Extensions.Caching.Dapr/1.0.1-alpha

Redis Implementation:https://www.nuget.org/packages/Microsoft.Extensions.Caching.StackExchangeRedis/8.0.4

License

This project is licensed under the terms of the MIT license.


Note: In this document, "Dapr" refers to "Distributed Application Runtime," an open-source project supported by Microsoft.

About

Implemented Microsoft.Extensions.Caching.Abstractions using Dapr's state store.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages