change ValueError -> TypeError and use redis setex method