Skip to content

Commit

Permalink
Reflect changes in Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanBout committed Jan 27, 2025
1 parent 89533e3 commit 53f7144
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 12 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ dotnet run --property:PublishAot=false -- --CDN:DataRoot <your_cdn_data>
| `Cache:Type` | `InMemory`, `Redis` or `Disabled` | `InMemory`, or if Redis has been configured, `Redis` | What cache provider to use, if any. |
| **In-Memory Options** |
| `Cache:InMemory:MaxSize` | A size in kB | `500_000` | How big the cache may grow. When an entry is added, the oldest entries will be removed until this limit is met. |
| `Cache:InMemory:PurgeInterval` | A TimeSpan | 5 minutes | How often the purge loop should wake up, to remove stale items older than `Cache:MaxAge` |
| **Redis Options** |
| `Cache:Redis:ConnectionString` | A redis connection string | None. Required when using Redis | How SimpleCDN should connect to your Redis instance. |
| `Cache:Redis:ClientName` | A string, without spaces | `SimpleCDN` | How SimpleCDN should identify itself to Redis. |
Expand Down
15 changes: 15 additions & 0 deletions extensions/Redis/IRedisCacheService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,24 @@

namespace SimpleCDN.Extensions.Redis
{
/// <summary>
/// Represents a service for storing and retrieving data in a Redis cache.
/// </summary>
/// <seealso cref="IDistributedCache"/>
public interface IRedisCacheService : IDistributedCache
{
/// <summary>
/// Gets the <see cref="ConnectionMultiplexer"/> instance used for the Redis cache.
/// </summary>
/// <seealso cref="ConnectionMultiplexer"/>
/// <seealso cref="GetRedisConnectionAsync"/>
public ConnectionMultiplexer GetRedisConnection();

/// <summary>
/// Gets the <see cref="ConnectionMultiplexer"/> instance used for the Redis cache asynchronously.
/// </summary>
/// <seealso cref="ConnectionMultiplexer"/>
/// <seealso cref="GetRedisConnection"/>
public Task<ConnectionMultiplexer> GetRedisConnectionAsync();
}
}
5 changes: 4 additions & 1 deletion extensions/Redis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ in for example a kubernetes cluster.

[The SimpleCDN Docker Image](https://ghcr.io/jonathanbout/simplecdn) comes with Redis support by default.

After registering the extension, the connection with Redis is accesible by injecting `IRedisCacheService` in your services.
For typical usage, you don't need to interact with this service directly, as SimpleCDN will handle this for you.

## Features
- Redis caching

Expand All @@ -19,4 +22,4 @@ var cdnBuilder = builder.Services.AddSimpleCDN();

- `options.ConnectionString`: The configuration string for the Redis server. This is a required property.
- `options.ClientName`: How the client should be identified to Redis. Default is `SimpleCDN`. This value can't contain whitespace.
- `options.KeyPrefix`: A string to prepend to all keys SimpleCDN inserts. Default is `SimpleCDN::`. An empty value is allowed, meaning no prefix is added.
- `options.KeyPrefix`: A string to prepend to all keys SimpleCDN inserts. Default is `SimpleCDN::`. An empty value is allowed, meaning no prefix is added.
20 changes: 12 additions & 8 deletions extensions/Redis/SimpleCDN.Extensions.Redis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,28 @@

<PropertyGroup>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Title>SimpleCDN Redis Extension</Title>
<Description>An extension for using Redis with SimpleCDN, the static file server.</Description>
<PackageIcon>logo.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Authors>JonathanBout</Authors>
<Company>SimpleCDN</Company>
<Copyright>Contributors of SimpleCDN</Copyright>
<Description>An extension for using Redis with SimpleCDN, the static file server.</Description>
<Copyright>© 2025 Contributors of SimpleCDN</Copyright>
<PackageProjectUrl>https://github.com/JonathanBout/SimpleCDN</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/JonathanBout/SimpleCDN.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>simplecdn-extension;redis</PackageTags>
<PackageTags>SimpleCDN Extension;Redis;ASP.NET Core</PackageTags>
<IsPackable>true</IsPackable>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<IncludeSymbols>True</IncludeSymbols>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<OutputType>Library</OutputType>
<PackageIcon>logo.png</PackageIcon>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<IsAotCompatible>true</IsAotCompatible>
<EnableRequestDelegateGenerator>true</EnableRequestDelegateGenerator>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>

Expand Down
12 changes: 12 additions & 0 deletions extensions/Redis/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
"version": 1,
"dependencies": {
"net8.0": {
"Microsoft.NET.ILLink.Tasks": {
"type": "Direct",
"requested": "[8.0.11, )",
"resolved": "8.0.11",
"contentHash": "zk5lnZrYJgtuJG8L4v17Ej8rZ3PUcR2iweNV08BaO5LbYHIi2wNaVNcJoLxvqgQdnjLlKnCCfVGLDr6QHeAarQ=="
},
"Roslynator.Analyzers": {
"type": "Direct",
"requested": "[4.12.10, )",
Expand Down Expand Up @@ -41,6 +47,12 @@
}
},
"net9.0": {
"Microsoft.NET.ILLink.Tasks": {
"type": "Direct",
"requested": "[9.0.0, )",
"resolved": "9.0.0",
"contentHash": "zAwp213evC3UkimtVXRb+Dlgc/40QG145nmZDtp2LO9zJJMfrp+i/87BnXN7tRXEA4liyzdFkjqG1HE8/RPb4A=="
},
"Roslynator.Analyzers": {
"type": "Direct",
"requested": "[4.12.10, )",
Expand Down
4 changes: 2 additions & 2 deletions src/core/SimpleCDN.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
<Authors>JonathanBout</Authors>
<Company>SimpleCDN</Company>
<Description>A simple CDN server for serving static files, with a local in-memory cache.</Description>
<Copyright>Contributors of SimpleCDN</Copyright>
<Copyright>© 2025 Contributors of SimpleCDN</Copyright>
<PackageProjectUrl>https://github.com/JonathanBout/SimpleCDN</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/JonathanBout/SimpleCDN.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>cdn;static files;cache;aspnetcore</PackageTags>
<PackageTags>CDN;static files;cache;ASP.NET Core</PackageTags>
<IsPackable>true</IsPackable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<OutputType>Library</OutputType>
Expand Down

0 comments on commit 53f7144

Please sign in to comment.