Soenneker.Validators.ExpiringKey 2.1.277

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.277                
NuGet\Install-Package Soenneker.Validators.ExpiringKey -Version 2.1.277                
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.277" />                
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.277                
#r "nuget: Soenneker.Validators.ExpiringKey, 2.1.277"                
#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.277

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

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.374 0 9/29/2024
2.1.373 0 9/29/2024
2.1.372 0 9/29/2024
2.1.371 6 9/29/2024
2.1.370 23 9/29/2024
2.1.369 24 9/29/2024
2.1.368 27 9/29/2024
2.1.367 24 9/29/2024
2.1.366 29 9/27/2024
2.1.365 32 9/27/2024
2.1.364 28 9/27/2024
2.1.363 34 9/27/2024
2.1.362 30 9/27/2024
2.1.361 32 9/27/2024
2.1.360 32 9/27/2024
2.1.359 30 9/27/2024
2.1.358 38 9/27/2024
2.1.357 30 9/27/2024
2.1.356 28 9/27/2024
2.1.355 28 9/27/2024
2.1.354 33 9/27/2024
2.1.353 33 9/27/2024
2.1.352 32 9/27/2024
2.1.351 35 9/27/2024
2.1.350 41 9/27/2024
2.1.349 30 9/27/2024
2.1.348 37 9/26/2024
2.1.347 34 9/26/2024
2.1.346 36 9/26/2024
2.1.345 34 9/26/2024
2.1.344 40 9/26/2024
2.1.343 36 9/26/2024
2.1.342 32 9/26/2024
2.1.341 33 9/26/2024
2.1.340 34 9/26/2024
2.1.339 34 9/26/2024
2.1.338 34 9/26/2024
2.1.337 37 9/26/2024
2.1.336 34 9/26/2024
2.1.335 33 9/26/2024
2.1.334 39 9/26/2024
2.1.333 58 9/24/2024
2.1.332 72 9/23/2024
2.1.331 62 9/23/2024
2.1.330 73 9/23/2024
2.1.329 72 9/23/2024
2.1.328 71 9/23/2024
2.1.327 63 9/23/2024
2.1.326 81 9/23/2024
2.1.325 61 9/23/2024
2.1.324 70 9/23/2024
2.1.323 67 9/23/2024
2.1.322 72 9/23/2024
2.1.321 65 9/23/2024
2.1.320 60 9/23/2024
2.1.319 68 9/23/2024
2.1.318 78 9/23/2024
2.1.317 63 9/23/2024
2.1.316 63 9/23/2024
2.1.315 72 9/23/2024
2.1.314 59 9/23/2024
2.1.313 61 9/23/2024
2.1.312 66 9/19/2024
2.1.311 65 9/18/2024
2.1.310 69 9/18/2024
2.1.309 65 9/18/2024
2.1.308 74 9/18/2024
2.1.307 67 9/18/2024
2.1.306 73 9/18/2024
2.1.305 74 9/17/2024
2.1.304 76 9/17/2024
2.1.303 66 9/17/2024
2.1.302 64 9/17/2024
2.1.301 72 9/17/2024
2.1.300 72 9/17/2024
2.1.299 69 9/17/2024
2.1.297 62 9/17/2024
2.1.296 94 9/17/2024
2.1.295 80 9/17/2024
2.1.294 85 9/17/2024
2.1.293 87 9/17/2024
2.1.292 81 9/17/2024
2.1.291 87 9/17/2024
2.1.290 83 9/17/2024
2.1.289 86 9/16/2024
2.1.288 78 9/16/2024
2.1.287 83 9/16/2024
2.1.286 88 9/16/2024
2.1.285 85 9/16/2024
2.1.284 82 9/16/2024
2.1.283 85 9/16/2024
2.1.282 95 9/12/2024
2.1.281 91 9/12/2024
2.1.280 102 9/12/2024
2.1.279 86 9/12/2024
2.1.278 91 9/12/2024
2.1.277 97 9/12/2024
2.1.276 86 9/12/2024
2.1.275 85 9/11/2024
2.1.274 88 9/11/2024
2.1.273 87 9/11/2024
2.1.272 88 9/11/2024
2.1.271 83 9/11/2024
2.1.269 94 9/11/2024
2.1.268 82 9/11/2024
2.1.267 86 9/11/2024
2.1.266 96 9/11/2024
2.1.265 84 9/11/2024
2.1.264 86 9/11/2024
2.1.263 84 9/10/2024
2.1.262 86 9/10/2024
2.1.261 88 9/10/2024
2.1.260 86 9/10/2024
2.1.259 84 9/10/2024
2.1.258 82 9/10/2024
2.1.257 75 9/10/2024
2.1.256 76 9/10/2024
2.1.255 74 9/10/2024
2.1.254 81 9/10/2024
2.1.253 83 9/10/2024
2.1.252 79 9/10/2024
2.1.251 79 9/10/2024
2.1.249 83 9/10/2024
2.1.248 75 9/10/2024
2.1.247 76 9/9/2024
2.1.246 79 9/9/2024
2.1.244 79 9/9/2024
2.1.243 87 9/9/2024
2.1.242 79 9/9/2024
2.1.241 80 9/9/2024
2.1.239 83 9/9/2024
2.1.238 74 9/9/2024
2.1.237 85 9/9/2024
2.1.236 82 9/9/2024
2.1.235 88 9/7/2024
2.1.234 87 9/7/2024
2.1.233 85 9/7/2024
2.1.232 77 9/7/2024
2.1.231 81 9/7/2024
2.1.230 79 9/7/2024
2.1.229 88 9/7/2024
2.1.228 75 9/7/2024
2.1.227 99 9/6/2024
2.1.226 86 9/6/2024
2.1.225 90 9/6/2024
2.1.224 88 9/6/2024
2.1.223 77 9/6/2024
2.1.222 93 9/6/2024
2.1.221 82 9/6/2024
2.1.220 87 9/6/2024
2.1.219 94 9/5/2024
2.1.218 83 9/5/2024
2.1.217 78 9/5/2024
2.1.216 73 9/5/2024
2.1.215 87 9/5/2024
2.1.214 84 9/5/2024
2.1.213 86 9/5/2024
2.1.212 83 9/5/2024
2.1.211 89 9/5/2024
2.1.210 79 9/5/2024
2.1.209 90 9/5/2024
2.1.208 84 9/5/2024
2.1.207 82 9/5/2024
2.1.206 83 9/5/2024
2.1.205 82 9/5/2024
2.1.204 84 9/5/2024
2.1.203 81 9/4/2024
2.1.202 81 9/4/2024
2.1.201 86 9/4/2024
2.1.200 84 9/4/2024
2.1.199 94 9/4/2024
2.1.198 85 9/3/2024
2.1.197 82 9/3/2024
2.1.196 87 9/3/2024
2.1.195 84 9/3/2024
2.1.194 86 9/3/2024
2.1.193 79 9/3/2024
2.1.192 60 9/3/2024
2.1.191 74 9/3/2024
2.1.190 93 9/3/2024
2.1.189 87 9/3/2024
2.1.188 81 9/3/2024
2.1.187 80 9/3/2024
2.1.186 73 9/3/2024
2.1.185 85 8/30/2024
2.1.184 91 8/29/2024
2.1.183 80 8/29/2024
2.1.182 85 8/29/2024
2.1.181 85 8/29/2024
2.1.180 81 8/29/2024
2.1.179 84 8/29/2024
2.1.178 91 8/26/2024
2.1.177 96 8/26/2024
2.1.176 98 8/26/2024
2.1.175 89 8/26/2024
2.1.174 88 8/26/2024
2.1.173 90 8/26/2024
2.1.172 95 8/26/2024
2.1.171 115 8/21/2024
2.1.170 113 8/21/2024
2.1.169 114 8/21/2024
2.1.168 113 8/21/2024
2.1.167 111 8/21/2024
2.1.166 110 8/21/2024
2.1.165 109 8/21/2024
2.1.164 106 8/21/2024
2.1.163 115 8/20/2024
2.1.162 112 8/20/2024
2.1.161 108 8/20/2024
2.1.160 102 8/20/2024
2.1.159 103 8/20/2024
2.1.158 89 8/20/2024
2.1.157 102 8/20/2024
2.1.156 93 8/20/2024
2.1.155 106 8/20/2024
2.1.154 102 8/20/2024
2.1.153 102 8/20/2024
2.1.152 102 8/20/2024
2.1.151 99 8/20/2024
2.1.150 104 8/19/2024
2.1.149 92 8/19/2024
2.1.148 110 8/15/2024
2.1.147 106 8/15/2024
2.1.146 107 8/15/2024
2.1.145 107 8/15/2024
2.1.144 108 8/15/2024
2.1.143 99 8/15/2024
2.1.142 102 8/14/2024
2.1.141 106 8/14/2024
2.1.140 81 8/14/2024
2.1.139 91 8/14/2024
2.1.138 88 8/14/2024
2.1.137 107 8/13/2024
2.1.136 74 8/7/2024
2.1.135 71 8/7/2024
2.1.134 96 8/7/2024
2.1.133 89 8/7/2024
2.1.132 88 8/7/2024
2.1.131 86 8/7/2024
2.1.130 74 8/7/2024
2.1.129 87 8/6/2024
2.1.128 72 8/6/2024
2.1.127 62 8/6/2024
2.1.126 68 8/1/2024
2.1.125 57 8/1/2024
2.1.124 55 8/1/2024
2.1.123 66 8/1/2024
2.1.122 60 8/1/2024
2.1.121 77 8/1/2024
2.1.120 65 8/1/2024
2.1.117 62 7/25/2024
2.1.116 76 7/25/2024
2.1.115 71 7/25/2024
2.1.114 76 7/25/2024
2.1.113 79 7/25/2024
2.1.112 75 7/25/2024
2.1.111 80 7/25/2024
2.1.110 79 7/25/2024
2.1.109 79 7/25/2024
2.1.108 74 7/25/2024
2.1.107 71 7/25/2024
2.1.106 80 7/24/2024
2.1.105 77 7/24/2024
2.1.103 92 7/24/2024
2.1.102 79 7/20/2024
2.1.101 70 7/20/2024
2.1.100 83 7/20/2024
2.1.99 83 7/20/2024
2.1.98 82 7/20/2024
2.1.97 77 7/20/2024
2.1.96 82 7/14/2024
2.1.95 70 7/14/2024
2.1.94 72 7/14/2024
2.1.93 58 7/14/2024
2.1.92 74 7/14/2024
2.1.91 75 7/14/2024
2.1.90 77 7/14/2024
2.1.89 78 7/14/2024
2.1.88 75 7/14/2024
2.1.87 69 7/14/2024
2.1.86 79 7/11/2024
2.1.85 76 7/10/2024
2.1.84 77 7/10/2024
2.1.83 75 7/10/2024
2.1.82 82 7/10/2024
2.1.81 75 7/10/2024
2.1.80 66 7/10/2024
2.1.79 79 7/10/2024
2.1.76 58 7/10/2024
2.1.75 85 7/10/2024
2.1.74 74 7/10/2024
2.1.73 74 7/10/2024
2.1.72 66 7/10/2024
2.1.71 76 7/10/2024
2.1.70 70 7/10/2024
2.1.69 67 7/10/2024
2.1.66 66 7/10/2024
2.1.65 84 7/10/2024
2.1.64 83 7/9/2024
2.1.61 52 7/9/2024
2.1.60 75 7/9/2024
2.1.59 73 7/9/2024
2.1.58 84 7/9/2024
2.1.57 78 7/9/2024
2.1.56 95 7/9/2024
2.1.55 96 7/9/2024
2.1.54 87 7/9/2024
2.1.53 81 7/9/2024
2.1.52 81 7/9/2024
2.1.51 83 7/9/2024
2.1.50 79 7/9/2024
2.1.49 72 7/9/2024
2.1.48 90 7/9/2024
2.1.47 76 7/9/2024
2.1.46 101 7/9/2024
2.1.45 98 7/8/2024
2.1.44 70 7/8/2024
2.1.43 85 7/8/2024
2.1.42 98 7/8/2024
2.1.41 80 7/8/2024
2.1.40 90 7/8/2024
2.1.39 72 7/8/2024
2.1.38 73 7/8/2024
2.1.37 99 7/7/2024
2.1.36 79 7/7/2024
2.1.35 92 7/7/2024
2.1.34 74 7/7/2024
2.1.33 101 7/3/2024
2.1.32 85 7/3/2024
2.1.31 104 7/3/2024
2.1.30 92 7/3/2024
2.1.29 91 7/3/2024
2.1.28 89 7/3/2024
2.1.27 89 7/3/2024
2.1.26 81 7/3/2024
2.1.25 84 7/3/2024
2.1.24 103 6/27/2024
2.1.23 106 6/27/2024
2.1.22 104 6/27/2024
2.1.21 100 6/27/2024
2.1.20 88 6/22/2024
2.1.19 94 6/22/2024
2.1.18 100 6/22/2024
2.1.17 96 6/22/2024
2.1.16 93 6/22/2024
2.1.15 99 6/16/2024
2.1.14 88 6/16/2024
2.1.13 82 6/15/2024
2.1.12 94 6/15/2024
2.1.11 78 6/15/2024
2.1.10 89 6/15/2024
2.1.9 105 6/15/2024
2.1.8 75 6/15/2024
2.1.7 89 6/15/2024
2.1.6 94 6/15/2024
2.1.5 77 6/15/2024
2.1.4 93 6/12/2024
2.1.3 82 6/12/2024