Created
June 22, 2020 16:34
-
-
Save kblok/98dbfecdc27e9332601fce6554256ef1 to your computer and use it in GitHub Desktop.
SetContentWithInvalidationIndexes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public Task SetContentAsync(string key, string value, TimeSpan? timespan, IEnumerable<string> invalidationIndexes, int database, ConnectionMultiplexer redisConn) | |
| { | |
| redisConn = redisConn ?? ConnectionHelper.Connection; | |
| var cache = redisConn.GetDatabase(database); | |
| var tasks = invalidationIndexes.Select(ix => cache.SetAddAsync(ix, key)).ToList(); | |
| tasks.Add(cache.StringSetAsync(key.ToLower(), value, expiry: timespan)); | |
| return Task.WhenAll(tasks); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment