Soenneker.Validators.ExpiringKey
2.1.117
Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Soenneker.Validators.ExpiringKey --version 2.1.117
NuGet\Install-Package Soenneker.Validators.ExpiringKey -Version 2.1.117
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="Soenneker.Validators.ExpiringKey" Version="2.1.117" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Soenneker.Validators.ExpiringKey --version 2.1.117
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Soenneker.Validators.ExpiringKey, 2.1.117"
#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 Soenneker.Validators.ExpiringKey as a Cake Addin #addin nuget:?package=Soenneker.Validators.ExpiringKey&version=2.1.117 // Install Soenneker.Validators.ExpiringKey as a Cake Tool #tool nuget:?package=Soenneker.Validators.ExpiringKey&version=2.1.117
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Soenneker.Validators.ExpiringKey
A validation module that checks for keys, stores them, expires them after an amount of time
Ideal for caching, session management, and more.
🚀 Features
- Validate Key: Check if a key exists.
- Add Key: Add a key with an expiration time.
- Validate and Add: Validate if a key exists and add it if not.
- Remove Key: Remove a key.
Installation
dotnet add package Soenneker.Validators.ExpiringKey
💻 Usage
IExpiringKeyValidator
can be registered within DI, and injected:
public static async Task Main(string[] args)
{
...
builder.Services.AddExpiringKeyValidatorAsSingleton();
}
or it can be initialized manually: new ExpiringKeyValidator()
.
Validate Key
Check if a key is present.
bool Validate(string key)
Add Key
Add a key with an expiration time.
void Add(string key, int expirationTimeMilliseconds)
Validate and Add Key
Validate a key and add it if it doesn't exist.
bool ValidateAndAdd(string key, int expirationTimeMilliseconds) // true if doesn't exist, false if it does
Remove Key
Remove a key.
void Remove(string key)
Example
var validator = new ExpiringKeyValidator();
validator.Add("key1", 5000); // 5 seconds
var invalid = validator.Validate("key1"); // false, key exists
await Task.Delay(7000); // wait 7 seconds
var validAfterTime = validator.Validate("key1"); // true, key does not exist
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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.
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
- Soenneker.Dictionaries.ExpiringKey (>= 2.1.79)
- Soenneker.Validators.Validator (>= 2.1.269)
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 |
---|---|---|
2.1.185 | 28 | 8/30/2024 |
2.1.184 | 31 | 8/29/2024 |
2.1.183 | 26 | 8/29/2024 |
2.1.182 | 29 | 8/29/2024 |
2.1.181 | 27 | 8/29/2024 |
2.1.180 | 24 | 8/29/2024 |
2.1.179 | 29 | 8/29/2024 |
2.1.178 | 68 | 8/26/2024 |
2.1.177 | 71 | 8/26/2024 |
2.1.176 | 71 | 8/26/2024 |
2.1.175 | 62 | 8/26/2024 |
2.1.174 | 63 | 8/26/2024 |
2.1.173 | 67 | 8/26/2024 |
2.1.172 | 54 | 8/26/2024 |
2.1.171 | 73 | 8/21/2024 |
2.1.170 | 76 | 8/21/2024 |
2.1.169 | 74 | 8/21/2024 |
2.1.168 | 72 | 8/21/2024 |
2.1.167 | 75 | 8/21/2024 |
2.1.166 | 78 | 8/21/2024 |
2.1.165 | 72 | 8/21/2024 |
2.1.164 | 65 | 8/21/2024 |
2.1.163 | 78 | 8/20/2024 |
2.1.162 | 73 | 8/20/2024 |
2.1.161 | 69 | 8/20/2024 |
2.1.160 | 64 | 8/20/2024 |
2.1.159 | 67 | 8/20/2024 |
2.1.158 | 65 | 8/20/2024 |
2.1.157 | 63 | 8/20/2024 |
2.1.156 | 59 | 8/20/2024 |
2.1.155 | 63 | 8/20/2024 |
2.1.154 | 63 | 8/20/2024 |
2.1.153 | 63 | 8/20/2024 |
2.1.152 | 64 | 8/20/2024 |
2.1.151 | 61 | 8/20/2024 |
2.1.150 | 70 | 8/19/2024 |
2.1.149 | 59 | 8/19/2024 |
2.1.148 | 70 | 8/15/2024 |
2.1.147 | 69 | 8/15/2024 |
2.1.146 | 69 | 8/15/2024 |
2.1.145 | 67 | 8/15/2024 |
2.1.144 | 66 | 8/15/2024 |
2.1.143 | 62 | 8/15/2024 |
2.1.142 | 66 | 8/14/2024 |
2.1.141 | 66 | 8/14/2024 |
2.1.140 | 66 | 8/14/2024 |
2.1.139 | 62 | 8/14/2024 |
2.1.138 | 64 | 8/14/2024 |
2.1.137 | 67 | 8/13/2024 |
2.1.136 | 67 | 8/7/2024 |
2.1.135 | 64 | 8/7/2024 |
2.1.134 | 64 | 8/7/2024 |
2.1.133 | 66 | 8/7/2024 |
2.1.132 | 64 | 8/7/2024 |
2.1.131 | 68 | 8/7/2024 |
2.1.130 | 66 | 8/7/2024 |
2.1.129 | 64 | 8/6/2024 |
2.1.128 | 53 | 8/6/2024 |
2.1.127 | 56 | 8/6/2024 |
2.1.126 | 45 | 8/1/2024 |
2.1.125 | 39 | 8/1/2024 |
2.1.124 | 36 | 8/1/2024 |
2.1.123 | 42 | 8/1/2024 |
2.1.122 | 39 | 8/1/2024 |
2.1.121 | 53 | 8/1/2024 |
2.1.120 | 43 | 8/1/2024 |
2.1.117 | 57 | 7/25/2024 |
2.1.116 | 57 | 7/25/2024 |
2.1.115 | 53 | 7/25/2024 |
2.1.114 | 62 | 7/25/2024 |
2.1.113 | 61 | 7/25/2024 |
2.1.112 | 58 | 7/25/2024 |
2.1.111 | 59 | 7/25/2024 |
2.1.110 | 61 | 7/25/2024 |
2.1.109 | 60 | 7/25/2024 |
2.1.108 | 52 | 7/25/2024 |
2.1.107 | 67 | 7/25/2024 |
2.1.106 | 63 | 7/24/2024 |
2.1.105 | 61 | 7/24/2024 |
2.1.103 | 60 | 7/24/2024 |
2.1.102 | 62 | 7/20/2024 |
2.1.101 | 51 | 7/20/2024 |
2.1.100 | 66 | 7/20/2024 |
2.1.99 | 66 | 7/20/2024 |
2.1.98 | 67 | 7/20/2024 |
2.1.97 | 60 | 7/20/2024 |
2.1.96 | 64 | 7/14/2024 |
2.1.95 | 54 | 7/14/2024 |
2.1.94 | 57 | 7/14/2024 |
2.1.93 | 54 | 7/14/2024 |
2.1.92 | 54 | 7/14/2024 |
2.1.91 | 60 | 7/14/2024 |
2.1.90 | 56 | 7/14/2024 |
2.1.89 | 55 | 7/14/2024 |
2.1.88 | 57 | 7/14/2024 |
2.1.87 | 53 | 7/14/2024 |
2.1.86 | 63 | 7/11/2024 |
2.1.85 | 59 | 7/10/2024 |
2.1.84 | 58 | 7/10/2024 |
2.1.83 | 60 | 7/10/2024 |
2.1.82 | 65 | 7/10/2024 |
2.1.81 | 58 | 7/10/2024 |
2.1.80 | 62 | 7/10/2024 |
2.1.79 | 62 | 7/10/2024 |
2.1.76 | 54 | 7/10/2024 |
2.1.75 | 64 | 7/10/2024 |
2.1.74 | 58 | 7/10/2024 |
2.1.73 | 56 | 7/10/2024 |
2.1.72 | 53 | 7/10/2024 |
2.1.71 | 63 | 7/10/2024 |
2.1.70 | 57 | 7/10/2024 |
2.1.69 | 63 | 7/10/2024 |
2.1.66 | 62 | 7/10/2024 |
2.1.65 | 63 | 7/10/2024 |
2.1.64 | 63 | 7/9/2024 |
2.1.61 | 47 | 7/9/2024 |
2.1.60 | 54 | 7/9/2024 |
2.1.59 | 55 | 7/9/2024 |
2.1.58 | 66 | 7/9/2024 |
2.1.57 | 61 | 7/9/2024 |
2.1.56 | 73 | 7/9/2024 |
2.1.55 | 77 | 7/9/2024 |
2.1.54 | 65 | 7/9/2024 |
2.1.53 | 76 | 7/9/2024 |
2.1.52 | 60 | 7/9/2024 |
2.1.51 | 64 | 7/9/2024 |
2.1.50 | 63 | 7/9/2024 |
2.1.49 | 66 | 7/9/2024 |
2.1.48 | 69 | 7/9/2024 |
2.1.47 | 59 | 7/9/2024 |
2.1.46 | 83 | 7/9/2024 |
2.1.45 | 81 | 7/8/2024 |
2.1.44 | 52 | 7/8/2024 |
2.1.43 | 66 | 7/8/2024 |
2.1.42 | 80 | 7/8/2024 |
2.1.41 | 62 | 7/8/2024 |
2.1.40 | 74 | 7/8/2024 |
2.1.39 | 68 | 7/8/2024 |
2.1.38 | 69 | 7/8/2024 |
2.1.37 | 81 | 7/7/2024 |
2.1.36 | 63 | 7/7/2024 |
2.1.35 | 73 | 7/7/2024 |
2.1.34 | 56 | 7/7/2024 |
2.1.33 | 83 | 7/3/2024 |
2.1.32 | 68 | 7/3/2024 |
2.1.31 | 88 | 7/3/2024 |
2.1.30 | 74 | 7/3/2024 |
2.1.29 | 76 | 7/3/2024 |
2.1.28 | 72 | 7/3/2024 |
2.1.27 | 70 | 7/3/2024 |
2.1.26 | 59 | 7/3/2024 |
2.1.25 | 70 | 7/3/2024 |
2.1.24 | 80 | 6/27/2024 |
2.1.23 | 86 | 6/27/2024 |
2.1.22 | 85 | 6/27/2024 |
2.1.21 | 82 | 6/27/2024 |
2.1.20 | 83 | 6/22/2024 |
2.1.19 | 74 | 6/22/2024 |
2.1.18 | 80 | 6/22/2024 |
2.1.17 | 80 | 6/22/2024 |
2.1.16 | 79 | 6/22/2024 |
2.1.15 | 80 | 6/16/2024 |
2.1.14 | 70 | 6/16/2024 |
2.1.13 | 77 | 6/15/2024 |
2.1.12 | 73 | 6/15/2024 |
2.1.11 | 72 | 6/15/2024 |
2.1.10 | 74 | 6/15/2024 |
2.1.9 | 82 | 6/15/2024 |
2.1.8 | 71 | 6/15/2024 |
2.1.7 | 72 | 6/15/2024 |
2.1.6 | 75 | 6/15/2024 |
2.1.5 | 71 | 6/15/2024 |
2.1.4 | 75 | 6/12/2024 |
2.1.3 | 66 | 6/12/2024 |