removed some old code

This commit is contained in:
Boki 2025-06-26 18:17:09 -04:00
parent bd26ecf3bc
commit c5f6b37022
11 changed files with 1 additions and 767 deletions

View file

@ -1,47 +0,0 @@
import type { AwilixContainer } from 'awilix';
import { NamespacedCache, type CacheProvider } from '@stock-bot/cache';
import type { ServiceDefinitions } from '../container/types';
export class CacheFactory {
static createNamespacedCache(baseCache: CacheProvider, namespace: string): NamespacedCache {
return new NamespacedCache(baseCache, namespace);
}
static createCacheForService(
container: AwilixContainer<ServiceDefinitions>,
serviceName: string
): CacheProvider | null {
const baseCache = container.cradle.cache;
if (!baseCache) {
return null;
}
return this.createNamespacedCache(baseCache, serviceName);
}
static createCacheForHandler(
container: AwilixContainer<ServiceDefinitions>,
handlerName: string
): CacheProvider | null {
const baseCache = container.cradle.cache;
if (!baseCache) {
return null;
}
return this.createNamespacedCache(baseCache, `handler:${handlerName}`);
}
static createCacheWithPrefix(
container: AwilixContainer<ServiceDefinitions>,
prefix: string
): CacheProvider | null {
const baseCache = container.cradle.cache;
if (!baseCache) {
return null;
}
// Remove 'cache:' prefix if already included
const cleanPrefix = prefix.replace(/^cache:/, '');
return this.createNamespacedCache(baseCache, cleanPrefix);
}
}

View file

@ -1 +1 @@
export { CacheFactory } from './cache.factory';
// This directory is reserved for future factory implementations

View file

@ -18,5 +18,3 @@ export {
queueConfigSchema
} from './config/schemas';
// Export factories
export { CacheFactory } from './factories';