MSP-2370 use more abstract naming in cache repo
This commit is contained in:
1 parent
7069f43366
commit
365bddceda
1 file changed
+6
-6
@@ -20,18 +20,18 @@ func NewAuthorizationCache(duration time.Duration) *AuthorizationCache {
|
||||
}
|
||||
}
|
||||
|
||||
func (r AuthorizationCache) Get(ctx context.Context, applicationId int, endpoint string) (bool, error) {
|
||||
key := r.key(applicationId, endpoint)
|
||||
func (r AuthorizationCache) Get(ctx context.Context, id int, endpoint string) (bool, error) {
|
||||
key := r.key(id, endpoint)
|
||||
_, ok := r.cache.Get(key)
|
||||
return ok, nil
|
||||
}
|
||||
|
||||
func (r AuthorizationCache) SetAuthorized(ctx context.Context, applicationId int, endpoint string) error {
|
||||
key := r.key(applicationId, endpoint)
|
||||
func (r AuthorizationCache) SetAuthorized(ctx context.Context, id int, endpoint string) error {
|
||||
key := r.key(id, endpoint)
|
||||
r.cache.Set(key, nil, r.duration)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r AuthorizationCache) key(applicationId int, endpoint string) string {
|
||||
return fmt.Sprintf("%d:%s", applicationId, endpoint)
|
||||
func (r AuthorizationCache) key(id int, endpoint string) string {
|
||||
return fmt.Sprintf("%d:%s", id, endpoint)
|
||||
}
|
||||
Reference in new issue
Block a user