mirror of
https://github.com/outline/outline.git
synced 2026-11-21 05:24:03 +03:00
* Initial plan * Refactor Redis cache keys: delegate CacheHelper to RedisPrefixHelper and update callers Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com> * Add JSDoc documentation to getCollectionDocumentsKey method Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com> * Remove unused indirection * Remove mock --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com> Co-authored-by: Tom Moor <tom@getoutline.com>
36 lines
995 B
TypeScript
36 lines
995 B
TypeScript
/**
|
|
* Helper class for Redis cache key generation.
|
|
*/
|
|
export class RedisPrefixHelper {
|
|
/**
|
|
* Gets key against which unfurl response for the given url is stored.
|
|
*
|
|
* @param teamId The team ID to generate a key for.
|
|
* @param url The url to generate a key for.
|
|
*/
|
|
public static getUnfurlKey(teamId: string, url = "") {
|
|
return `unfurl:${teamId}:${url}`;
|
|
}
|
|
|
|
/**
|
|
* Gets key for caching collection documents structure.
|
|
*
|
|
* @param collectionId The collection ID to generate a key for.
|
|
* @returns the cache key string.
|
|
*/
|
|
public static getCollectionDocumentsKey(collectionId: string) {
|
|
return `cd:${collectionId}`;
|
|
}
|
|
|
|
/**
|
|
* Gets key for caching embed check results. This is a global cache key
|
|
* (not team-specific) since embed headers are the same for all users.
|
|
*
|
|
* @param url The URL to generate a cache key for.
|
|
* @returns the cache key string.
|
|
*/
|
|
public static getEmbedCheckKey(url: string) {
|
|
return `embed:${url}`;
|
|
}
|
|
}
|