IObjectList <T, THeader> IObjectStorage.CreateList <T, THeader>(DataBuffer keySpace, StorageKey key, THeader header, DateTime ttl, Func <T> creator) { var ret = new MockObjectList <T, THeader>(header); Iface.Put(keySpace, key, new StorageEntry <MockObjectList <T, THeader> >(ret, DateTime.Now, ttl)); return(ret); }
public static async Task PutString(this IObjectStorage reader, string fileName, string value, string mimeType, CancellationToken cancellationToken = default) { await reader.Put(fileName, stream => { using (var writer = new StreamWriter(stream)) { writer.Write(value); } }, mimeType, cancellationToken); }
public static async Task PutJSON <T>(this IObjectStorage reader, string fileName, T value, CancellationToken cancellationToken = default) { await reader.Put(fileName, stream => { using (var sr = new StreamWriter(stream)) using (var jsonWriter = new JsonTextWriter(sr)) { JToken.FromObject(value).WriteTo(jsonWriter); } }, "application/json", cancellationToken); }