Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // compiling
- async setState(id: string, state: any): Promise<void> {
- const previousState = cache.get('id') || {};
- const newState = { ...previousState, ...state };
- if (isEqual(newState, previousState)) {
- return;
- }
- await redis.hset(STATE_KEY, id, JSON.stringify(newState));
- cache.set(id, newState);
- }
- // not compiling
- async setState(id: string, state: any): Promise<void> {
- const previousState = cache.get(id) || {};
- const newState = { ...previousState, ...state };
- if (!isEqual(previousState, newState)) {
- await redis.hset(STATE_KEY, id, JSON.stringify(newState));
- cache.set(id, newState);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement