ram64
Version:
Multi-threaded 64bit memory cache database inspired by redis-like features
15 lines (12 loc) • 442 B
text/typescript
import { CommandFn, CommandOptions } from '../../commands';
import { Shard, CacheObject } from '../../types';
import { fn as del } from './del';
export const fn: CommandFn = (opts: CommandOptions): void => {
const shard = opts.shard as Shard;
const obj: CacheObject = opts.args as CacheObject;
if (obj?.value === undefined) {
del(opts);
} else {
shard.map.set(opts.key as string, obj);
}
}