設置成功返回 1 。
當 key 不存在或者不能為 key 設置生存時間時(比如在低於 2.1.3 版本的 Redis 中你嘗試更新 key 的生存時間),返回 0 。
redis> SET cache_page "www.google.com" OK redis> EXPIRE cache_page 30 # 設置過期時間為 30 秒 (integer) 1 redis> TTL cache_page # 查看剩余生存時間 (integer) 23 redis> EXPIRE cache_page 30000 # 更新過期時間 (integer) 1 redis> TTL cache_page (integer) 29996
源文:https://blog.csdn.net/u012045045/article/details/82901876
