Advertisement
roman_gemini

Proof

Jan 29th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // compiling
  2. async setState(id: string, state: any): Promise<void> {
  3.     const previousState = cache.get('id') || {};
  4.     const newState = { ...previousState, ...state };
  5.  
  6.     if (isEqual(newState, previousState)) {
  7.       return;
  8.     }
  9.  
  10.     await redis.hset(STATE_KEY, id, JSON.stringify(newState));
  11.     cache.set(id, newState);
  12. }
  13.  
  14. // not compiling
  15. async setState(id: string, state: any): Promise<void> {
  16.     const previousState = cache.get(id) || {};
  17.     const newState = { ...previousState, ...state };
  18.  
  19.     if (!isEqual(previousState, newState)) {
  20.       await redis.hset(STATE_KEY, id, JSON.stringify(newState));
  21.       cache.set(id, newState);
  22.     }
  23.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement