ram64
Version:
Multi-threaded 64bit memory cache database inspired by redis-like features
14 lines (10 loc) • 450 B
text/typescript
import { CommandFn, CommandOptions } from '../../commands';
import { fn as get } from './get';
import { fn as set } from './set';
export const fn: CommandFn = (opts: CommandOptions): string => {
const oldValue = get(opts);
const oldStr = typeof oldValue === 'string' ? oldValue : '';
const value = oldStr.replace(opts.args?.replace ?? '', opts.args?.value ?? '');
set({ ...opts, args: { value }});
return value;
}