Tamkeen.CacheService.Core
1.0.4.1
dotnet add package Tamkeen.CacheService.Core --version 1.0.4.1
NuGet\Install-Package Tamkeen.CacheService.Core -Version 1.0.4.1
<PackageReference Include="Tamkeen.CacheService.Core" Version="1.0.4.1" />
<PackageVersion Include="Tamkeen.CacheService.Core" Version="1.0.4.1" />
<PackageReference Include="Tamkeen.CacheService.Core" />
paket add Tamkeen.CacheService.Core --version 1.0.4.1
#r "nuget: Tamkeen.CacheService.Core, 1.0.4.1"
#:package Tamkeen.CacheService.Core@1.0.4.1
#addin nuget:?package=Tamkeen.CacheService.Core&version=1.0.4.1
#tool nuget:?package=Tamkeen.CacheService.Core&version=1.0.4.1
Tamkeen CacheService
Overview
Tamkeen CacheService is a .NET library for interacting with Redis, providing easy-to-use interfaces and classes for caching, locking, and database operations. The library is compatible with both .NET Core 8 and .NET Framework 4.7.
Features
- Easy-to-use interfaces for cache operations
- Support for synchronous and asynchronous operations
- Redis connection management
- Key expiry and locking mechanisms
Getting Started
Prerequisites
- .NET Core 8.0 or .NET Framework 4.7
- Redis server (local or remote)
Installation
To include Tamkeen CacheService in your project, run the following command:
Install-Package Tamkeen.RateLimiter.Core -Version 1.0.0
Configuration
Define the Redis connection configuration using the CacheConfig class:
var config = new CacheConfig
{
ClientName = "ExampleClient",
DefaultDatabase = 0,
AllowAdmin = true,
AbortOnConnectFail = false,
ConnectTimeout = 2000,
SyncTimeout = 1000,
EndPoint = "127.0.0.1:6379", // Replace with your Redis server endpoint
Password = "yourpassword" // Replace with your Redis server password if needed
};
Creating a Redis Connection Factory
Create an instance of RedisConnectionFactory:
IRedisConnectionFactory factory = new RedisConnectionFactory(config);
Using the Connection
Get the ConnectionMultiplexer and perform cache operations:
var connection = factory.Connection();
if (connection.IsConnected)
{
var db = factory.GetDatabase();
db.StringSet("exampleKey", "exampleValue");
string value = db.StringGet("exampleKey");
Console.WriteLine($"Value for 'exampleKey': {value}");
}
else
{
Console.WriteLine("Failed to connect to Redis.");
}
Cache Provider
Use the RedisCacheProvider for higher-level cache operations:
ICacheProvider cacheProvider = new RedisCacheProvider(factory);
cacheProvider.SetValue("exampleKey", "exampleValue", TimeSpan.FromMinutes(5));
string value = cacheProvider.GetValue<string>("exampleKey");
Console.WriteLine($"Cached value: {value}");
cacheProvider.DeleteValue("exampleKey");
Project Structure
Tamkeen.CacheService.Core
├── Classes
│ ├── CacheConfig.cs
│ ├── ConnectionMultiplexerWrapper.cs
│ ├── RedisCacheProvider.cs
│ ├── RedisConnectionFactory.cs
├── Interfaces
│ ├── ICacheProvider.cs
│ ├── IConnectionMultiplexerWrapper.cs
│ ├── IRedisConnectionFactory.cs
Running the Tests
To run the tests, use the following command:
dotnet test
This will execute the unit tests against both .NET Core 8 and .NET Framework 4.7.
Contributing
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Documentation
- Project summary: docs/PROJECT_SUMMARY.md
- Architecture: docs/ARCHITECTURE.md
- Configuration: docs/CONFIGURATION.md
- Operations (build/run/test/coverage): docs/OPERATIONS.md
- Contributing: docs/CONTRIBUTING.md
- Code Style: docs/CODE_STYLE.md
- Security: docs/SECURITY.md
Contact
For questions or feedback, please contact support@tamkeen.com.ye.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Framework | net47 is compatible. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 4.7
- Microsoft.Bcl.AsyncInterfaces (>= 8.0.0)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- Pipelines.Sockets.Unofficial (>= 2.2.8)
- StackExchange.Redis (>= 2.8.0)
- System.Data.DataSetExtensions (>= 4.5.0)
- System.Diagnostics.PerformanceCounter (>= 8.0.0)
- System.IO.Pipelines (>= 8.0.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Threading.Channels (>= 8.0.0)
-
net7.0
- Microsoft.Bcl.AsyncInterfaces (>= 8.0.0)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- Pipelines.Sockets.Unofficial (>= 2.2.8)
- StackExchange.Redis (>= 2.8.0)
- System.Data.DataSetExtensions (>= 4.5.0)
- System.Diagnostics.PerformanceCounter (>= 8.0.0)
- System.IO.Pipelines (>= 8.0.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Threading.Channels (>= 8.0.0)
-
net8.0
- Microsoft.Bcl.AsyncInterfaces (>= 8.0.0)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- Pipelines.Sockets.Unofficial (>= 2.2.8)
- StackExchange.Redis (>= 2.8.0)
- System.Data.DataSetExtensions (>= 4.5.0)
- System.Diagnostics.PerformanceCounter (>= 8.0.0)
- System.IO.Pipelines (>= 8.0.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Threading.Channels (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.