added cli-covarage tool and fixed more tests

This commit is contained in:
Boki 2025-06-26 14:23:01 -04:00
parent b63e58784c
commit b845a8eade
57 changed files with 11917 additions and 295 deletions

View file

@ -167,13 +167,18 @@ export class RedisCache implements CacheProvider {
getOldValue?: boolean;
}
): Promise<T | null> {
// Validate options before safeExecute
const config = typeof options === 'number' ? { ttl: options } : options || {};
if (config.onlyIfExists && config.onlyIfNotExists) {
throw new Error('Cannot specify both onlyIfExists and onlyIfNotExists');
}
return this.safeExecute(
async () => {
const fullKey = this.getKey(key);
const serialized = typeof value === 'string' ? value : JSON.stringify(value);
// Handle backward compatibility - if options is a number, treat as TTL
const config = typeof options === 'number' ? { ttl: options } : options || {};
// Config is already parsed and validated above
let oldValue: T | null = null;
@ -216,9 +221,6 @@ export class RedisCache implements CacheProvider {
}
} else {
// Standard set logic with conditional operations
if (config.onlyIfExists && config.onlyIfNotExists) {
throw new Error('Cannot specify both onlyIfExists and onlyIfNotExists');
}
if (config.onlyIfExists) {
// Only set if key exists (XX flag)