public Stream Set([NotNull] string key, object state, [NotNull] Action<ICacheContext> create) { var data = _memCache.Set<byte[]>(key, state, context => { var subContext = new LocalContextWrapper(context); create(subContext); return subContext.GetBytes(); }); return new MemoryStream(data, writable: false); }
public async Task <Stream> SetAsync([NotNull] string key, object state, [NotNull] Func <ICacheContext, Task> create) { var data = await _memCache.SetAsync <byte[]>(key, link : null, state : state, create : async context => { var subContext = new LocalContextWrapper(context); await create(subContext); return(subContext.GetBytes()); }); return(new MemoryStream(data, writable: false)); }
public Stream Set([NotNull] string key, object state, [NotNull] Action <ICacheContext> create) { var data = _memCache.Set <byte[]>(key, state, context => { var subContext = new LocalContextWrapper(context); create(subContext); return(subContext.GetBytes()); }); return(new MemoryStream(data, writable: false)); }