-
Notifications
You must be signed in to change notification settings - Fork 99
Implementers howto #39
Comments
@thrawn01 I'm trying to use gubernator as a library and have some domain-specific logic around it as well as persistence. I've got a few questions to clarify what the intended direction is around library usage. I see two ways of using gubernator as a library:
Ideally i'd use My questions are:
|
We took the We have a func (g *guberStore) OnChange(r *gubernator.RateLimitReq, item *gubernator.CacheItem) {
// We don't store ratelimits that will expire in under a minute, only ratelimits with
// a duration longer than 1 minute are stored.
if durationUnderMinute(r) {
return
}
gsItem := guberStoreItem{
ExpireAt: bsonx.DateTime(item.ExpireAt),
CacheItem: *item,
HashKey: r.HashKey(),
}
// Queue the gsItem to be written to the database, we queue writes to the database
// this so this method doesn't block while waiting for the db to write to return
g.writer.Queue(&gsItem)
} We do have custom logic, and for that we created a separate GRPC interface that mimics the gubernator GRPC interface but with our modifications. |
Create a implementers README with information on how to properly implement and manage a gubernator persistent store.
The text was updated successfully, but these errors were encountered: