public ICacheProvider <string, testObj> GetProvider() { MemcachedCluster cls = new MemcachedCluster("localhost"); cls.Start(); return(new MemcachedCacheProvider <testObj>(cls)); }
static async Task Main(string[] args) { // connect to a list of memcached servers var cluster = new MemcachedCluster("localhost,localhost:11212,localhost:11213"); // this is mandatory cluster.Start(); var client = cluster.GetClient(); await client.SetAsync("hello", new { hello = "world" }); // more work // stop the cluster cluster.Dispose(); }
private async Task RunEnyim() { using var _enyim = new MemcachedCluster("10.0.0.21:11211"); _enyim.Start(); var _enyimClient = _enyim.GetClient(); var list = new List <Task>(); for (var i = 0; i < Threads; i++) { list.Add(Task.Run(async() => { await _enyimClient.SetAsync(Key, Value); foreach (var batch in Enumerable.Range(0, Iterations).Batch(200)) { await Task.WhenAll(batch.Select(x => _enyimClient.GetAsync(Key))); } })); } await Task.WhenAll(list); }