-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for default cache name on client creation #291
Conversation
c950046
to
403d1a0
Compare
f2c537b
to
3e991e7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a couple minor questions / nits but otherwise lgtm
e1b74aa
to
9394581
Compare
return commonCacheClient(props) | ||
} | ||
|
||
func (c defaultScsClient) getCacheNameForRequest(request hasCacheName) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When users call this function with NewCacheClient
, it returns defaultCache
, right? Where are we setting this default cache?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And for the Go SDK, this means that a cache is always created with both NewCacheClient
and NewCacheClientWithDefaultCache
even if users didn't provide a cache name when calling CreateCache
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default cache is set in the NewCacheClientWithDefaultCache
constructor, which returns a CacheClient
just like the NewCacheClient
constructor. If the client was created using NewCacheClient
, it will not have a default cache set and the user has to provide a cache name as part of each request. If the client was created with NewCacheClientWithDefaultCache
, it will have a default cache and the user can omit the cache name from the requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
This commit adds a CacheClient constructor that sets a default cache name for the client. If
CacheName
is omitted from a given request, the default is used. It also adds a simple happy path test for the new client, mostly as a usage example. Will follow with more complete testing once the basic shape of the client is approved.