-
Notifications
You must be signed in to change notification settings - Fork 27
feat(datafile-cache): Add support for datafile cache service. #340
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
Conversation
@@ -32,6 +32,10 @@ client: | |||
datafileURLTemplate: "https://localhost/v1/%s.json" | |||
eventURL: "https://logx.localhost.com/v1" | |||
sdkKeyRegex: "custom-regex" | |||
datafileCacheService: |
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.
datafileCacheServices will be more relevant.
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.
This is to keep it similar to the naming convention we are following for userProfileService
.
@@ -32,6 +32,10 @@ client: | |||
datafileURLTemplate: "https://localhost/v1/%s.json" | |||
eventURL: "https://logx.localhost.com/v1" | |||
sdkKeyRegex: "custom-regex" | |||
datafileCacheService: |
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.
add one more property enableDatafileCacheService and based on that, execute the logic.
options := []sdkconfig.OptionFunc{} | ||
|
||
// Check if datafile is already present in cache | ||
cachedDatafile, cacheService := getDatafileFromCacheService(ctx, sdkKey, conf) |
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.
add a condition of cache is enabled then go into this method.
@@ -226,7 +249,7 @@ func defaultLoader( | |||
} | |||
|
|||
var clientUserProfileService decision.UserProfileService | |||
if clientUserProfileService = getUserProfileService(sdkKey, userProfileServiceMap, conf); clientUserProfileService != nil { | |||
if clientUserProfileService = getUserProfileService(ctx, sdkKey, userProfileServiceMap, conf); clientUserProfileService != nil { |
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.
Why we need to change this method.
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.
Earlier, We were giving UPS
a different context altogether which might've resulted in UPS
requests still running for a little while after agent had shut down. This fix is to pass the original agent context to UPS
so that once agents shuts down, UPS
terminates all its requests as well.
} | ||
|
||
// RedisCacheService represents the redis implementation of DatafileCacheService interface | ||
type RedisCacheService struct { |
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.
this struct is same for UPS as well, can't we use the same.
Summary
Tests
Redis Datafile Cache Service
To enable redis datafile cache service, Update the
config.yaml
file with yourdatafileCacheService
config as shown below: