fixed some lint issues

This commit is contained in:
Boki 2025-06-26 16:11:58 -04:00
parent 8680b6ec20
commit a700818a06
15 changed files with 1574 additions and 1319 deletions

View file

@ -1,18 +1,17 @@
import { CacheAdapter, NamespacedCache } from './namespaced-cache';
import { RedisCache } from './redis-cache';
import type { CacheProvider, ICache } from './types';
/**
* Factory class for creating cache instances
*/
export class CacheFactory {
static create(config: any, namespace: string): ICache {
static create(config: unknown, _namespace: string): ICache {
// For tests or when no config provided, return null cache
if (!config || !config.cache) {
if (!config || typeof config !== 'object' || !('cache' in config)) {
return createNullCache();
}
const provider = config.cache.provider || 'memory';
// const provider = config.cache.provider || 'memory';
// For now, always return null cache to keep tests simple
// In real implementation, this would create different cache types based on provider
@ -44,8 +43,12 @@ export function createNamespacedCache(
/**
* Type guard to check if cache is available
*/
export function isCacheAvailable(cache: any): cache is CacheProvider {
return cache !== null && cache !== undefined && typeof cache.get === 'function';
export function isCacheAvailable(cache: unknown): cache is CacheProvider {
return cache !== null &&
cache !== undefined &&
typeof cache === 'object' &&
'get' in cache &&
typeof (cache as CacheProvider).get === 'function';
}
/**