Skip to content

Commit

Permalink
chore: Rename MultiGet and MultiSet to GetMulti and SetMulti. (#73)
Browse files Browse the repository at this point in the history
The previous naming convention preferred modifiers before commands, as
in `MultiGet`, `DictionaryMultiGet`. This ordering makes it
difficult to group commands under the IDE and in documentation. The
new ordering `GetMulti`, `DictionaryGetMulti` eases this.

With this way, now the following will be completions of
`DictionaryGet`:

`DictionaryGet`, `DictionaryGetMulti`, `DictionaryGetAll`
  • Loading branch information
malandis authored Jul 14, 2022
1 parent 8cb1b22 commit 77a1c76
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 130 deletions.
4 changes: 2 additions & 2 deletions Momento/Incubating/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Driver
key: "my-key", value: "my-value", ttlSeconds: 60, refreshTtl: false);

// Set multiple values
scc.DictionaryMultiSet(
scc.DictionarySetMulti(
cacheName: "my-cache",
dictionaryName: "my-dictionary",
new Dictionary<string, string>() {
Expand All @@ -42,7 +42,7 @@ class Driver
string value = gr.String(); // "value1"
// Get multiple values
CacheDictionaryMultiGetResponse mgr = scc.DictionaryMultiGet(
CacheDictionaryGetMultiResponse mgr = scc.DictionaryGetMulti(
cacheName: "my-cache",
dictionaryName: "my-dictionary",
"key1", "key2", "key3", "key4");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

namespace MomentoSdk.Incubating.Responses
{
public class CacheDictionaryMultiGetResponse
public class CacheDictionaryGetMultiResponse
{
public CacheDictionaryMultiGetResponse()
public CacheDictionaryGetMultiResponse()
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

namespace MomentoSdk.Incubating.Responses
{
public class CacheDictionaryMultiSetResponse
public class CacheDictionarySetMultiResponse
{
public CacheDictionaryMultiSetResponse()
public CacheDictionarySetMultiResponse()
{
}

Expand Down
24 changes: 12 additions & 12 deletions Momento/Incubating/SimpleCacheClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,44 +51,44 @@ public async Task<CacheDictionaryGetResponse> DictionaryGetAsync(string cacheNam
return await Task.FromException<CacheDictionaryGetResponse>(new NotImplementedException());
}

public CacheDictionaryMultiSetResponse DictionaryMultiSet(string cacheName, string dictionaryName, IDictionary<byte[], byte[]> dictionary, bool refreshTtl, uint? ttlSeconds = null)
public CacheDictionarySetMultiResponse DictionarySetMulti(string cacheName, string dictionaryName, IDictionary<byte[], byte[]> dictionary, bool refreshTtl, uint? ttlSeconds = null)
{
throw new NotImplementedException();
}

public CacheDictionaryMultiSetResponse DictionaryMultiSet(string cacheName, string dictionaryName, IDictionary<string, string> dictionary, bool refreshTtl, uint? ttlSeconds = null)
public CacheDictionarySetMultiResponse DictionarySetMulti(string cacheName, string dictionaryName, IDictionary<string, string> dictionary, bool refreshTtl, uint? ttlSeconds = null)
{
throw new NotImplementedException();
}

public async Task<CacheDictionaryMultiSetResponse> DictionaryMultiSetAsync(string cacheName, string dictionaryName, IDictionary<string, string> dictionary, bool refreshTtl, uint? ttlSeconds = null)
public async Task<CacheDictionarySetMultiResponse> DictionarySetMultiAsync(string cacheName, string dictionaryName, IDictionary<string, string> dictionary, bool refreshTtl, uint? ttlSeconds = null)
{
return await Task.FromException<CacheDictionaryMultiSetResponse>(new NotImplementedException());
return await Task.FromException<CacheDictionarySetMultiResponse>(new NotImplementedException());
}

public async Task<CacheDictionaryMultiSetResponse> DictionaryMultiSetAsync(string cacheName, string dictionaryName, IDictionary<byte[], byte[]> dictionary, bool refreshTtl, uint? ttlSeconds = null)
public async Task<CacheDictionarySetMultiResponse> DictionarySetMultiAsync(string cacheName, string dictionaryName, IDictionary<byte[], byte[]> dictionary, bool refreshTtl, uint? ttlSeconds = null)
{
return await Task.FromException<CacheDictionaryMultiSetResponse>(new NotImplementedException());
return await Task.FromException<CacheDictionarySetMultiResponse>(new NotImplementedException());
}

public CacheDictionaryMultiGetResponse DictionaryMultiGet(string cacheName, string dictionaryName, params byte[][] keys)
public CacheDictionaryGetMultiResponse DictionaryGetMulti(string cacheName, string dictionaryName, params byte[][] keys)
{
throw new NotImplementedException();
}

public CacheDictionaryMultiGetResponse DictionaryMultiGet(string cacheName, string dictionaryName, params string[] keys)
public CacheDictionaryGetMultiResponse DictionaryGetMulti(string cacheName, string dictionaryName, params string[] keys)
{
throw new NotImplementedException();
}

public async Task<CacheDictionaryMultiGetResponse> DictionaryMultiGetAsync(string cacheName, string dictionaryName, params byte[][] keys)
public async Task<CacheDictionaryGetMultiResponse> DictionaryGetMultiAsync(string cacheName, string dictionaryName, params byte[][] keys)
{
return await Task.FromException<CacheDictionaryMultiGetResponse>(new NotImplementedException());
return await Task.FromException<CacheDictionaryGetMultiResponse>(new NotImplementedException());
}

public async Task<CacheDictionaryMultiGetResponse> DictionaryMultiGetAsync(string cacheName, string dictionaryName, params string[] keys)
public async Task<CacheDictionaryGetMultiResponse> DictionaryGetMultiAsync(string cacheName, string dictionaryName, params string[] keys)
{
return await Task.FromException<CacheDictionaryMultiGetResponse>(new NotImplementedException());
return await Task.FromException<CacheDictionaryGetMultiResponse>(new NotImplementedException());
}

public CacheDictionaryGetAllResponse DictionaryGetAll(string cacheName, string dictionaryName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace MomentoSdk.Responses
{
public class CacheMultiGetResponse
public class CacheGetMultiResponse
{
private readonly List<CacheGetResponse> responses;

public CacheMultiGetResponse(IEnumerable<CacheGetResponse> responses)
public CacheGetMultiResponse(IEnumerable<CacheGetResponse> responses)
{
this.responses = new(responses);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

namespace MomentoSdk.Responses
{
public class CacheMultiSetResponse
public class CacheSetMultiResponse
{
private readonly object items;

public CacheMultiSetResponse(IDictionary<byte[], byte[]> items)
public CacheSetMultiResponse(IDictionary<byte[], byte[]> items)
{
this.items = (object)items;
}

public CacheMultiSetResponse(IDictionary<string, string> items)
public CacheSetMultiResponse(IDictionary<string, string> items)
{
this.items = (object)items;
}
Expand Down
22 changes: 11 additions & 11 deletions Momento/ScsDataClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ public async Task<CacheSetResponse> SetAsync(string cacheName, string key, byte[
return new CacheSetResponse(response);
}

public async Task<CacheMultiGetResponse> MultiGetAsync(string cacheName, IEnumerable<string> keys)
public async Task<CacheGetMultiResponse> GetMultiAsync(string cacheName, IEnumerable<string> keys)
{
return await MultiGetAsync(cacheName, keys.Select(key => Convert(key)));
return await GetMultiAsync(cacheName, keys.Select(key => Convert(key)));
}

public async Task<CacheMultiGetResponse> MultiGetAsync(string cacheName, IEnumerable<byte[]> keys)
public async Task<CacheGetMultiResponse> GetMultiAsync(string cacheName, IEnumerable<byte[]> keys)
{
return await MultiGetAsync(cacheName, keys.Select(key => Convert(key)));
return await GetMultiAsync(cacheName, keys.Select(key => Convert(key)));
}

public async Task<CacheMultiGetResponse> MultiGetAsync(string cacheName, IEnumerable<ByteString> keys)
public async Task<CacheGetMultiResponse> GetMultiAsync(string cacheName, IEnumerable<ByteString> keys)
{
// Gather the tasks
var tasks = keys.Select(key => SendGetAsync(cacheName, key));
Expand Down Expand Up @@ -104,24 +104,24 @@ public async Task<CacheMultiGetResponse> MultiGetAsync(string cacheName, IEnumer

// Package results
var results = continuation.Result.Select(response => new CacheGetResponse(response));
return new CacheMultiGetResponse(results);
return new CacheGetMultiResponse(results);
}

public async Task MultiSetAsync(string cacheName, IDictionary<string, string> items, uint? ttlSeconds = null)
public async Task SetMultiAsync(string cacheName, IDictionary<string, string> items, uint? ttlSeconds = null)
{
await MultiSetAsync(cacheName: cacheName,
await SetMultiAsync(cacheName: cacheName,
items: items.ToDictionary(item => Convert(item.Key), item => Convert(item.Value)),
ttlSeconds: ttlSeconds);
}

public async Task MultiSetAsync(string cacheName, IDictionary<byte[], byte[]> items, uint? ttlSeconds = null)
public async Task SetMultiAsync(string cacheName, IDictionary<byte[], byte[]> items, uint? ttlSeconds = null)
{
await MultiSetAsync(cacheName: cacheName,
await SetMultiAsync(cacheName: cacheName,
items: items.ToDictionary(item => Convert(item.Key), item => Convert(item.Value)),
ttlSeconds: ttlSeconds);
}

public async Task MultiSetAsync(string cacheName, IDictionary<ByteString, ByteString> items, uint? ttlSeconds = null)
public async Task SetMultiAsync(string cacheName, IDictionary<ByteString, ByteString> items, uint? ttlSeconds = null)
{
// Gather the tasks
var tasks = items.Select(item => SendSetAsync(cacheName, item.Key, item.Value, ttlSeconds));
Expand Down
Loading

0 comments on commit 77a1c76

Please sign in to comment.