ram64
Version:
Multi-threaded 64bit memory cache database inspired by redis-like features
16 lines (12 loc) • 499 B
text/typescript
import { CommandFn, CommandOptions } from '../../commands';
import type { CacheObject } from '../../types';
import { fn as getWithOptions } from './getWithOptions';
import { fn as del } from './del';
import { fn as setWithOptions } from './setWithOptions';
export const fn: CommandFn = (opts: CommandOptions): CacheObject|undefined => {
const obj = getWithOptions(opts);
if (!obj) return void 0;
del(opts);
setWithOptions({ ...opts, args: obj });
return obj;
}