Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions db-connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -16467,21 +16467,6 @@ func GetAllCacheKeys(ctx context.Context, orgId string, category string, max int

}

// Only cache if NO cursor at all.
// Otherwise we need to track and clean up all cursors(?)
if project.CacheDb {
newcache, err := json.Marshal(cacheKeys)
if err != nil {
log.Printf("[WARNING] Failed marshalling cacheKeys: %s", err)
return cacheKeys, cursor, nil
}

err = SetCache(ctx, cacheKey, newcache, 5)
if err != nil {
log.Printf("[WARNING] Failed updating cache keys cache: %s", err)
}
}

foundOrg, err := GetOrg(ctx, orgId)
if err == nil && len(foundOrg.CreatorOrg) > 0 && foundOrg.CreatorOrg != orgId {
parentOrg, err := GetOrg(ctx, foundOrg.CreatorOrg)
Expand Down Expand Up @@ -16516,6 +16501,21 @@ func GetAllCacheKeys(ctx context.Context, orgId string, category string, max int
}
}

// Only cache if NO cursor at all.
// Otherwise we need to track and clean up all cursors(?)
if project.CacheDb {
newcache, err := json.Marshal(cacheKeys)
if err != nil {
log.Printf("[WARNING] Failed marshalling cacheKeys: %s", err)
return cacheKeys, cursor, nil
}

err = SetCache(ctx, cacheKey, newcache, 5)
if err != nil {
log.Printf("[WARNING] Failed updating cache keys cache: %s", err)
}
}

return cacheKeys, cursor, nil
}

Expand Down
8 changes: 8 additions & 0 deletions shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -20896,6 +20896,14 @@ func HandleDeleteCacheKeyPost(resp http.ResponseWriter, request *http.Request) {
DeleteCache(ctx, fmt.Sprintf("%s_%s", entity, cacheId))
DeleteCache(ctx, fmt.Sprintf("%s_%s", entity, url.QueryEscape(cacheId)))

normalizedCategory := strings.ReplaceAll(strings.ToLower(tmpData.Category), " ", "_")
if normalizedCategory == "default" {
normalizedCategory = ""
}
DeleteCache(ctx, fmt.Sprintf("%s__%s_%s", entity, org.Id, normalizedCategory))
DeleteCache(ctx, fmt.Sprintf("%s__%s_", entity, org.Id))
DeleteCache(ctx, fmt.Sprintf("%s__%s", entity, org.Id))

result := ResultChecker{
Success: true,
Reason: fmt.Sprintf("Key '%s' deleted", tmpData.Key),
Expand Down
Loading