Soenneker.Validators.ExpiringKey 2.1.371

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Validators.ExpiringKey --version 2.1.371                
NuGet\Install-Package Soenneker.Validators.ExpiringKey -Version 2.1.371                
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.371" />                
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.371                
#r "nuget: Soenneker.Validators.ExpiringKey, 2.1.371"                
#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.371

// Install Soenneker.Validators.ExpiringKey as a Cake Tool
#tool nuget:?package=Soenneker.Validators.ExpiringKey&version=2.1.371                

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image 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 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.

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.493 0 11/9/2024
2.1.492 0 11/9/2024
2.1.491 0 11/9/2024
2.1.490 0 11/9/2024
2.1.489 0 11/9/2024
2.1.488 8 11/8/2024
2.1.487 6 11/8/2024
2.1.486 20 11/8/2024
2.1.485 19 11/8/2024
2.1.484 17 11/8/2024
2.1.483 20 11/8/2024
2.1.482 20 11/8/2024
2.1.481 17 11/8/2024
2.1.480 20 11/8/2024
2.1.479 33 11/6/2024
2.1.478 29 11/6/2024
2.1.477 63 11/1/2024
2.1.476 63 11/1/2024
2.1.475 61 11/1/2024
2.1.474 55 11/1/2024
2.1.473 73 10/29/2024
2.1.472 61 10/29/2024
2.1.471 76 10/29/2024
2.1.470 60 10/29/2024
2.1.469 70 10/29/2024
2.1.468 68 10/29/2024
2.1.467 70 10/29/2024
2.1.466 62 10/29/2024
2.1.465 62 10/29/2024
2.1.464 64 10/29/2024
2.1.463 61 10/29/2024
2.1.462 60 10/29/2024
2.1.461 67 10/28/2024
2.1.460 66 10/28/2024
2.1.459 71 10/26/2024
2.1.458 72 10/26/2024
2.1.457 71 10/26/2024
2.1.456 64 10/26/2024
2.1.455 69 10/26/2024
2.1.454 73 10/22/2024
2.1.453 63 10/22/2024
2.1.452 67 10/22/2024
2.1.451 66 10/22/2024
2.1.450 68 10/22/2024
2.1.449 71 10/22/2024
2.1.448 64 10/22/2024
2.1.447 63 10/22/2024
2.1.446 64 10/22/2024
2.1.445 57 10/22/2024
2.1.444 61 10/22/2024
2.1.443 104 10/18/2024
2.1.442 100 10/18/2024
2.1.441 74 10/17/2024
2.1.440 81 10/17/2024
2.1.439 76 10/17/2024
2.1.438 75 10/17/2024
2.1.437 74 10/15/2024
2.1.436 71 10/15/2024
2.1.435 66 10/15/2024
2.1.434 72 10/15/2024
2.1.433 77 10/14/2024
2.1.432 76 10/12/2024
2.1.431 79 10/12/2024
2.1.430 73 10/12/2024
2.1.429 75 10/12/2024
2.1.428 72 10/12/2024
2.1.427 80 10/11/2024
2.1.426 72 10/11/2024
2.1.425 75 10/11/2024
2.1.424 79 10/11/2024
2.1.423 81 10/11/2024
2.1.422 76 10/9/2024
2.1.421 73 10/9/2024
2.1.420 73 10/9/2024
2.1.419 73 10/9/2024
2.1.418 74 10/9/2024
2.1.417 69 10/9/2024
2.1.416 77 10/9/2024
2.1.415 71 10/9/2024
2.1.414 72 10/9/2024
2.1.413 65 10/9/2024
2.1.412 76 10/9/2024
2.1.411 72 10/9/2024
2.1.410 73 10/8/2024
2.1.409 73 10/8/2024
2.1.408 72 10/8/2024
2.1.407 73 10/8/2024
2.1.406 70 10/8/2024
2.1.405 85 10/8/2024
2.1.404 74 10/8/2024
2.1.403 83 10/8/2024
2.1.402 72 10/3/2024
2.1.401 70 10/3/2024
2.1.400 65 10/3/2024
2.1.399 73 10/3/2024
2.1.398 73 10/3/2024
2.1.397 68 10/3/2024
2.1.396 116 10/3/2024
2.1.395 69 10/3/2024
2.1.394 76 10/3/2024
2.1.393 69 10/3/2024
2.1.392 73 10/2/2024
2.1.391 69 10/2/2024
2.1.390 70 10/2/2024
2.1.389 68 10/2/2024
2.1.388 78 10/2/2024
2.1.387 69 10/2/2024
2.1.386 63 10/2/2024
2.1.385 78 10/2/2024
2.1.384 75 10/2/2024
2.1.383 77 10/1/2024
2.1.382 66 10/1/2024
2.1.381 69 10/1/2024
2.1.380 70 10/1/2024
2.1.379 70 10/1/2024
2.1.378 73 10/1/2024
2.1.377 70 10/1/2024
2.1.376 74 10/1/2024
2.1.375 75 10/1/2024
2.1.374 76 9/29/2024
2.1.373 72 9/29/2024
2.1.372 78 9/29/2024
2.1.371 73 9/29/2024
2.1.370 81 9/29/2024
2.1.369 81 9/29/2024
2.1.368 85 9/29/2024
2.1.367 77 9/29/2024
2.1.366 73 9/27/2024
2.1.365 79 9/27/2024
2.1.364 75 9/27/2024
2.1.363 77 9/27/2024
2.1.362 74 9/27/2024
2.1.361 74 9/27/2024
2.1.360 75 9/27/2024
2.1.359 81 9/27/2024
2.1.358 83 9/27/2024
2.1.357 73 9/27/2024
2.1.356 74 9/27/2024
2.1.355 71 9/27/2024
2.1.354 81 9/27/2024
2.1.353 74 9/27/2024
2.1.352 72 9/27/2024
2.1.351 80 9/27/2024
2.1.350 85 9/27/2024
2.1.349 73 9/27/2024
2.1.348 75 9/26/2024
2.1.347 79 9/26/2024
2.1.346 84 9/26/2024
2.1.345 76 9/26/2024
2.1.344 84 9/26/2024
2.1.343 79 9/26/2024
2.1.342 81 9/26/2024
2.1.341 79 9/26/2024
2.1.340 77 9/26/2024
2.1.339 75 9/26/2024
2.1.338 76 9/26/2024
2.1.337 77 9/26/2024
2.1.336 75 9/26/2024
2.1.335 73 9/26/2024
2.1.334 80 9/26/2024
2.1.333 86 9/24/2024
2.1.332 82 9/23/2024
2.1.331 72 9/23/2024
2.1.330 83 9/23/2024
2.1.329 82 9/23/2024
2.1.328 81 9/23/2024
2.1.327 73 9/23/2024
2.1.326 91 9/23/2024
2.1.325 71 9/23/2024
2.1.324 80 9/23/2024
2.1.323 77 9/23/2024
2.1.322 82 9/23/2024
2.1.321 75 9/23/2024
2.1.320 70 9/23/2024
2.1.319 78 9/23/2024
2.1.318 88 9/23/2024
2.1.317 73 9/23/2024
2.1.316 73 9/23/2024
2.1.315 82 9/23/2024
2.1.314 69 9/23/2024
2.1.313 71 9/23/2024
2.1.312 75 9/19/2024
2.1.311 74 9/18/2024
2.1.310 78 9/18/2024
2.1.309 78 9/18/2024
2.1.308 87 9/18/2024
2.1.307 80 9/18/2024
2.1.306 87 9/18/2024
2.1.305 83 9/17/2024
2.1.304 89 9/17/2024
2.1.303 80 9/17/2024
2.1.302 78 9/17/2024
2.1.301 86 9/17/2024
2.1.300 86 9/17/2024
2.1.299 83 9/17/2024
2.1.297 76 9/17/2024
2.1.296 107 9/17/2024
2.1.295 93 9/17/2024
2.1.294 98 9/17/2024
2.1.293 100 9/17/2024
2.1.292 94 9/17/2024
2.1.291 96 9/17/2024
2.1.290 96 9/17/2024
2.1.289 99 9/16/2024
2.1.288 91 9/16/2024
2.1.287 96 9/16/2024
2.1.286 101 9/16/2024
2.1.285 98 9/16/2024
2.1.284 95 9/16/2024
2.1.283 98 9/16/2024
2.1.282 103 9/12/2024
2.1.281 100 9/12/2024
2.1.280 110 9/12/2024
2.1.279 94 9/12/2024
2.1.278 99 9/12/2024
2.1.277 105 9/12/2024
2.1.276 94 9/12/2024
2.1.275 93 9/11/2024
2.1.274 96 9/11/2024
2.1.273 95 9/11/2024
2.1.272 97 9/11/2024
2.1.271 92 9/11/2024
2.1.269 103 9/11/2024
2.1.268 91 9/11/2024
2.1.267 96 9/11/2024
2.1.266 106 9/11/2024
2.1.265 94 9/11/2024
2.1.264 96 9/11/2024
2.1.263 93 9/10/2024
2.1.262 95 9/10/2024
2.1.261 99 9/10/2024
2.1.260 96 9/10/2024
2.1.259 93 9/10/2024
2.1.258 91 9/10/2024
2.1.257 84 9/10/2024
2.1.256 86 9/10/2024
2.1.255 84 9/10/2024
2.1.254 91 9/10/2024
2.1.253 93 9/10/2024
2.1.252 89 9/10/2024
2.1.251 89 9/10/2024
2.1.249 93 9/10/2024
2.1.248 85 9/10/2024
2.1.247 86 9/9/2024
2.1.246 89 9/9/2024
2.1.244 89 9/9/2024
2.1.243 97 9/9/2024
2.1.242 89 9/9/2024
2.1.241 90 9/9/2024
2.1.239 93 9/9/2024
2.1.238 83 9/9/2024
2.1.237 95 9/9/2024
2.1.236 94 9/9/2024
2.1.235 98 9/7/2024
2.1.234 96 9/7/2024
2.1.233 95 9/7/2024
2.1.232 87 9/7/2024
2.1.231 91 9/7/2024
2.1.230 90 9/7/2024
2.1.229 98 9/7/2024
2.1.228 86 9/7/2024
2.1.227 109 9/6/2024
2.1.226 96 9/6/2024
2.1.225 100 9/6/2024
2.1.224 98 9/6/2024
2.1.223 87 9/6/2024
2.1.222 102 9/6/2024
2.1.221 91 9/6/2024
2.1.220 97 9/6/2024
2.1.219 103 9/5/2024
2.1.218 92 9/5/2024
2.1.217 88 9/5/2024
2.1.216 83 9/5/2024
2.1.215 97 9/5/2024
2.1.214 94 9/5/2024
2.1.213 96 9/5/2024
2.1.212 93 9/5/2024
2.1.211 99 9/5/2024
2.1.210 89 9/5/2024
2.1.209 100 9/5/2024
2.1.208 94 9/5/2024
2.1.207 92 9/5/2024
2.1.206 93 9/5/2024
2.1.205 92 9/5/2024
2.1.204 94 9/5/2024
2.1.203 90 9/4/2024
2.1.202 90 9/4/2024
2.1.201 95 9/4/2024
2.1.200 93 9/4/2024
2.1.199 104 9/4/2024
2.1.198 95 9/3/2024
2.1.197 93 9/3/2024
2.1.196 96 9/3/2024
2.1.195 93 9/3/2024
2.1.194 96 9/3/2024
2.1.193 90 9/3/2024
2.1.192 70 9/3/2024
2.1.191 84 9/3/2024
2.1.190 102 9/3/2024
2.1.189 96 9/3/2024
2.1.188 91 9/3/2024
2.1.187 90 9/3/2024
2.1.186 83 9/3/2024
2.1.185 91 8/30/2024
2.1.184 97 8/29/2024
2.1.183 86 8/29/2024
2.1.182 92 8/29/2024
2.1.181 90 8/29/2024
2.1.180 86 8/29/2024
2.1.179 89 8/29/2024
2.1.178 95 8/26/2024
2.1.177 100 8/26/2024
2.1.176 102 8/26/2024
2.1.175 93 8/26/2024
2.1.174 92 8/26/2024
2.1.173 95 8/26/2024
2.1.172 100 8/26/2024
2.1.171 119 8/21/2024
2.1.170 121 8/21/2024
2.1.169 118 8/21/2024
2.1.168 117 8/21/2024
2.1.167 115 8/21/2024
2.1.166 114 8/21/2024
2.1.165 113 8/21/2024
2.1.164 111 8/21/2024
2.1.163 120 8/20/2024
2.1.162 116 8/20/2024
2.1.161 112 8/20/2024
2.1.160 106 8/20/2024
2.1.159 108 8/20/2024
2.1.158 93 8/20/2024
2.1.157 106 8/20/2024
2.1.156 97 8/20/2024
2.1.155 110 8/20/2024
2.1.154 106 8/20/2024
2.1.153 106 8/20/2024
2.1.152 106 8/20/2024
2.1.151 103 8/20/2024
2.1.150 108 8/19/2024
2.1.149 96 8/19/2024
2.1.148 114 8/15/2024
2.1.147 110 8/15/2024
2.1.146 112 8/15/2024
2.1.145 111 8/15/2024
2.1.144 112 8/15/2024
2.1.143 103 8/15/2024
2.1.142 106 8/14/2024
2.1.141 110 8/14/2024
2.1.140 85 8/14/2024
2.1.139 95 8/14/2024
2.1.138 91 8/14/2024
2.1.137 110 8/13/2024
2.1.136 77 8/7/2024
2.1.135 76 8/7/2024
2.1.134 101 8/7/2024
2.1.133 94 8/7/2024
2.1.132 93 8/7/2024
2.1.131 91 8/7/2024
2.1.130 79 8/7/2024
2.1.129 91 8/6/2024
2.1.128 77 8/6/2024
2.1.127 67 8/6/2024
2.1.126 71 8/1/2024
2.1.125 62 8/1/2024
2.1.124 60 8/1/2024
2.1.123 71 8/1/2024
2.1.122 64 8/1/2024
2.1.121 80 8/1/2024
2.1.120 68 8/1/2024
2.1.117 65 7/25/2024
2.1.116 79 7/25/2024
2.1.115 74 7/25/2024
2.1.114 79 7/25/2024
2.1.113 82 7/25/2024
2.1.112 78 7/25/2024
2.1.111 83 7/25/2024
2.1.110 82 7/25/2024
2.1.109 82 7/25/2024
2.1.108 77 7/25/2024
2.1.107 74 7/25/2024
2.1.106 83 7/24/2024
2.1.105 80 7/24/2024
2.1.103 95 7/24/2024
2.1.102 82 7/20/2024
2.1.101 73 7/20/2024
2.1.100 86 7/20/2024
2.1.99 86 7/20/2024
2.1.98 85 7/20/2024
2.1.97 80 7/20/2024
2.1.96 84 7/14/2024
2.1.95 72 7/14/2024
2.1.94 74 7/14/2024
2.1.93 60 7/14/2024
2.1.92 76 7/14/2024
2.1.91 77 7/14/2024
2.1.90 79 7/14/2024
2.1.89 80 7/14/2024
2.1.88 77 7/14/2024
2.1.87 71 7/14/2024
2.1.86 81 7/11/2024
2.1.85 78 7/10/2024
2.1.84 79 7/10/2024
2.1.83 77 7/10/2024
2.1.82 84 7/10/2024
2.1.81 77 7/10/2024
2.1.80 68 7/10/2024
2.1.79 81 7/10/2024
2.1.76 60 7/10/2024
2.1.75 87 7/10/2024
2.1.74 76 7/10/2024
2.1.73 77 7/10/2024
2.1.72 69 7/10/2024
2.1.71 78 7/10/2024
2.1.70 71 7/10/2024
2.1.69 70 7/10/2024
2.1.66 67 7/10/2024
2.1.65 86 7/10/2024
2.1.64 85 7/9/2024
2.1.61 54 7/9/2024
2.1.60 77 7/9/2024
2.1.59 75 7/9/2024
2.1.58 86 7/9/2024
2.1.57 81 7/9/2024
2.1.56 99 7/9/2024
2.1.55 100 7/9/2024
2.1.54 89 7/9/2024
2.1.53 83 7/9/2024
2.1.52 82 7/9/2024
2.1.51 84 7/9/2024
2.1.50 80 7/9/2024
2.1.49 73 7/9/2024
2.1.48 91 7/9/2024
2.1.47 77 7/9/2024
2.1.46 102 7/9/2024
2.1.45 99 7/8/2024
2.1.44 71 7/8/2024
2.1.43 86 7/8/2024
2.1.42 99 7/8/2024
2.1.41 81 7/8/2024
2.1.40 91 7/8/2024
2.1.39 74 7/8/2024
2.1.38 75 7/8/2024
2.1.37 101 7/7/2024
2.1.36 81 7/7/2024
2.1.35 94 7/7/2024
2.1.34 76 7/7/2024
2.1.33 103 7/3/2024
2.1.32 87 7/3/2024
2.1.31 106 7/3/2024
2.1.30 94 7/3/2024
2.1.29 93 7/3/2024
2.1.28 91 7/3/2024
2.1.27 91 7/3/2024
2.1.26 83 7/3/2024
2.1.25 86 7/3/2024
2.1.24 105 6/27/2024
2.1.23 108 6/27/2024
2.1.22 106 6/27/2024
2.1.21 102 6/27/2024
2.1.20 90 6/22/2024
2.1.19 98 6/22/2024
2.1.18 102 6/22/2024
2.1.17 98 6/22/2024
2.1.16 95 6/22/2024
2.1.15 101 6/16/2024
2.1.14 92 6/16/2024
2.1.13 138 6/15/2024
2.1.12 96 6/15/2024
2.1.11 80 6/15/2024
2.1.10 91 6/15/2024
2.1.9 107 6/15/2024
2.1.8 79 6/15/2024
2.1.7 91 6/15/2024
2.1.6 95 6/15/2024
2.1.5 78 6/15/2024
2.1.4 94 6/12/2024
2.1.3 83 6/12/2024