handler to auto register and removed service registry, cleaned up queues and cache naming
This commit is contained in:
parent
0d1be9e3cb
commit
34c6c36695
19 changed files with 474 additions and 198 deletions
12
libs/core/cache/src/namespaced-cache.ts
vendored
12
libs/core/cache/src/namespaced-cache.ts
vendored
|
|
@ -86,4 +86,16 @@ export class NamespacedCache implements CacheProvider {
|
|||
getFullPrefix(): string {
|
||||
return this.prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value using a raw Redis key (bypassing the namespace prefix)
|
||||
* Delegates to the underlying cache's getRaw method if available
|
||||
*/
|
||||
async getRaw<T = unknown>(key: string): Promise<T | null> {
|
||||
if (this.cache.getRaw) {
|
||||
return this.cache.getRaw<T>(key);
|
||||
}
|
||||
// Fallback for caches that don't implement getRaw
|
||||
return null;
|
||||
}
|
||||
}
|
||||
23
libs/core/cache/src/redis-cache.ts
vendored
23
libs/core/cache/src/redis-cache.ts
vendored
|
|
@ -291,6 +291,29 @@ export class RedisCache implements CacheProvider {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value using a raw Redis key (bypassing the keyPrefix)
|
||||
* Useful for accessing cache data from other services with different prefixes
|
||||
*/
|
||||
async getRaw<T = unknown>(key: string): Promise<T | null> {
|
||||
return this.safeExecute(
|
||||
async () => {
|
||||
// Use the key directly without adding our prefix
|
||||
const value = await this.redis.get(key);
|
||||
if (!value) {
|
||||
this.updateStats(false);
|
||||
return null;
|
||||
}
|
||||
this.updateStats(true);
|
||||
const parsed = JSON.parse(value);
|
||||
this.logger.debug('Cache raw get hit', { key });
|
||||
return parsed;
|
||||
},
|
||||
null,
|
||||
'getRaw'
|
||||
);
|
||||
}
|
||||
|
||||
async keys(pattern: string): Promise<string[]> {
|
||||
return this.safeExecute(
|
||||
async () => {
|
||||
|
|
|
|||
6
libs/core/cache/src/types.ts
vendored
6
libs/core/cache/src/types.ts
vendored
|
|
@ -76,6 +76,12 @@ export interface CacheProvider {
|
|||
* Atomically update field with transformation function
|
||||
*/
|
||||
updateField?<T>(key: string, updater: (current: T | null) => T, ttl?: number): Promise<T | null>;
|
||||
|
||||
/**
|
||||
* Get a value using a raw Redis key (bypassing the keyPrefix)
|
||||
* Useful for accessing cache data from other services with different prefixes
|
||||
*/
|
||||
getRaw?<T>(key: string): Promise<T | null>;
|
||||
}
|
||||
|
||||
export interface CacheOptions {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue