WonderfulTools.WonderfulCaptcha.Cache.InMemory 10.2.1

dotnet add package WonderfulTools.WonderfulCaptcha.Cache.InMemory --version 10.2.1                
NuGet\Install-Package WonderfulTools.WonderfulCaptcha.Cache.InMemory -Version 10.2.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WonderfulTools.WonderfulCaptcha.Cache.InMemory" Version="10.2.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WonderfulTools.WonderfulCaptcha.Cache.InMemory --version 10.2.1                
#r "nuget: WonderfulTools.WonderfulCaptcha.Cache.InMemory, 10.2.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WonderfulTools.WonderfulCaptcha.Cache.InMemory as a Cake Addin
#addin nuget:?package=WonderfulTools.WonderfulCaptcha.Cache.InMemory&version=10.2.1

// Install WonderfulTools.WonderfulCaptcha.Cache.InMemory as a Cake Tool
#tool nuget:?package=WonderfulTools.WonderfulCaptcha.Cache.InMemory&version=10.2.1                

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

  1. Implement your custom cache provider:
public class MyCacheProvider : ICacheProvider
{
    // Your Implementation Here
}
  1. 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
10.2.1 81 11/24/2024
10.0.0 798 2/18/2024
8.0.1 350 1/15/2024
7.0.1 333 1/15/2024