WonderfulTools.WonderfulCaptcha.Cache.Redis
10.0.0
dotnet add package WonderfulTools.WonderfulCaptcha.Cache.Redis --version 10.0.0
NuGet\Install-Package WonderfulTools.WonderfulCaptcha.Cache.Redis -Version 10.0.0
<PackageReference Include="WonderfulTools.WonderfulCaptcha.Cache.Redis" Version="10.0.0" />
paket add WonderfulTools.WonderfulCaptcha.Cache.Redis --version 10.0.0
#r "nuget: WonderfulTools.WonderfulCaptcha.Cache.Redis, 10.0.0"
// Install WonderfulTools.WonderfulCaptcha.Cache.Redis as a Cake Addin #addin nuget:?package=WonderfulTools.WonderfulCaptcha.Cache.Redis&version=10.0.0 // Install WonderfulTools.WonderfulCaptcha.Cache.Redis as a Cake Tool #tool nuget:?package=WonderfulTools.WonderfulCaptcha.Cache.Redis&version=10.0.0
Wonderful Captcha
Wonderful Captcha is a simple and customizable CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) implementation for .NET applications.
Features
- Generate custom CAPTCHA images with random text.
- Easily integrate CAPTCHA functionality into your .NET web forms or applications.
- Customizable CAPTCHA image size, font, text color, background color, and noise level.
Usage
1- You can install Wonderful Captcha via NuGet Package Manager:
Install-Package WonderfulCaptcha
2- Use extension To Add WonderfulCaptcha
using WonderfulCaptcha;
// use extension to add wonderfulcaptcha to project
builder.Services.AddWonderfulCaptcha();
3- Generate CAPTCHA image in controler, service, ...
[ApiController]
[Route("[controller]/[action]")]
public class TestController : ControllerBase
{
private readonly IWonderfulCaptchaService _wonderfulCaptchaService;
public TestController(IWonderfulCaptchaService wonderfulCaptchaService)
{
_wonderfulCaptchaService = wonderfulCaptchaService;
}
[HttpGet]
public async Task<ActionResult> GenerateAsync(CancellationToken cancellationToken)
{
var value = await _wonderfulCaptchaService.GenerateAsync(cancellationToken: cancellationToken);
return Ok(value);
}
}
4- Verify CAPTCHA
var result = await _wonderfulCaptchaService.VerifyAsync(key, value, cancellationToken);
Here's an improved version of your package markdown file:
Caching
When using WonderfulCaptcha, you have the flexibility to choose from various cache providers to optimize performance and resource management.
InMemoryCache
The InMemoryCache
provider is suitable for smaller applications or scenarios where you prefer an in-memory caching mechanism.
Installation
Install-Package WonderfulTools.WonderfulCaptcha.Cache.InMemory
Usage
builder.Services.AddMemoryCache();
builder.Services.AddWonderfulCaptcha(o =>
{
o.UseInMemoryCacheProvider();
});
RedisCache
For larger applications or distributed environments, RedisCache
is an efficient choice due to its scalability and robustness.
Installation
Install-Package WonderfulTools.WonderfulCaptcha.Cache.Redis
Usage
builder.Services.AddStackExchangeRedisCache(options =>
{
options.Configuration = "localhost:6379";
options.InstanceName = "MyRedisInstance";
});
builder.Services.AddWonderfulCaptcha(o =>
{
o.UseRedisCacheProvider();
});
Custom Cache Provider
If you have specific caching requirements or wish to integrate with a different caching system, you can implement your own cache provider by implementing the ICacheProvider
interface.
Usage
- Implement your custom cache provider:
public class MyCacheProvider : ICacheProvider
{
// Your Implementation Here
}
- Register your custom cache provider:
builder.Services.AddWonderfulCaptcha(o =>
{
o.UseCustomCacheProvider<MyCacheProvider>();
});
By providing these options, WonderfulCaptcha ensures compatibility with various caching strategies, allowing you to optimize your application's performance according to your specific needs.
In this version, I've organized the content into clear sections for each cache provider, provided clear installation and usage instructions, and improved the overall readability of the document. Additionally, I've added more descriptive text to explain the benefits and use cases of each cache provider.
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. |
-
net7.0
- Microsoft.Extensions.Caching.Abstractions (>= 7.0.0)
- Newtonsoft.Json (>= 13.0.1)
- WonderfulTools.WonderfulCaptcha (>= 10.0.0)
-
net8.0
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Newtonsoft.Json (>= 13.0.1)
- WonderfulTools.WonderfulCaptcha (>= 10.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.