added cli-covarage tool and fixed more tests
This commit is contained in:
parent
b63e58784c
commit
b845a8eade
57 changed files with 11917 additions and 295 deletions
12
libs/core/cache/src/redis-cache.ts
vendored
12
libs/core/cache/src/redis-cache.ts
vendored
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue