services.AddElasticSearchCache(new BlueTiger.ElasticCache.Config.ElasticCacheConfigParameters {
CacheUrl = "http://localhost:9200"
});
var sp = services.BuildServiceProvider();
sp.UseElasticSearchCache();
await ECache.SetEntryAsync("test-entry", new { cache_entry = "cache-entry" }, TimeSpan.FromSeconds(8), true /* delay */);
bool hasEntry = await ECache.HasEntryAsync("test-entry"); // true
bool hasEntry2 = await ECache.HasEntryAsync("test-entry2"); // false
var entry = await ECache.GetEntryAsync<dynamic>("test-entry"); // non-null
Thread.Sleep(6000);
var entry2 = await ECache.GetEntryAsync<dynamic>("test-entry"); // non-null
var entry3 = await ECache.GetEntryAsync<dynamic>("test-entry2"); // null
Thread.Sleep(2000);
var entry4 = await ECache.GetEntryAsync<dynamic>("test-entry"); // expired, so null
erwinwolff/ECache
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published