-
Notifications
You must be signed in to change notification settings - Fork 194
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
[RedisCache] For RateLimiting #77
Conversation
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.
You should create a fork instead of directly opening a PR
client *commoncache.RedisClient | ||
} | ||
|
||
func NewRedisStore[T any](client *commoncache.RedisClient) common.KVStore[T] { |
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.
client
Should be an interface and not implementation
) | ||
|
||
type RedisStore[T any] struct { | ||
client *commoncache.RedisClient |
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.
Should be an interface and not implementation
return err | ||
} | ||
|
||
return s.client.Set(ctx, key, jsonData, 0).Err() // 0 means no expiration |
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.
What if we want do add expiration? What do you think of adding it as params?
"time" | ||
|
||
"github.com/Layr-Labs/eigenda/common" | ||
"github.com/go-redis/redis/v8" |
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 v8 and not v9
client *commoncache.RedisClient | ||
} | ||
|
||
func NewRedisStore[T any](client *commoncache.RedisClient) common.KVStore[T] { |
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.
Preferable to return pointer struct instead of interface by convention
*RedisStore[T]
type RedisStore[T any] struct { | ||
client *commoncache.RedisClient | ||
} | ||
|
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 this interface static checker.
var _ common.KVStore[any] = (*RedisStore[any])(nil)
Why are these changes needed?
Introduce RedisStore instead of dynamoDB for storing RateLimiting Params
Changes
Checks