Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. 快取種類
  2.  
  3. - database
  4. 存放於 DB table
  5.  
  6. - Memcached
  7. 記憶體快取
  8.  
  9. - Redis
  10.  
  11. 簡易概念:
  12. 1. 當 Cache 存在時,返回 Cache,反之重新取得,寫入 Cache
  13. 2. Cache 可設置保存時間,過期後清除
  14. 3. 也可設置永久保存,手動新增、修改、刪除
  15.  
  16. QA:
  17. 1. 如何做到 DB 更新時從 DB 取得,反之從 Cache 取得
  18. 在 DB 更新時,同步寫入 Cache,讀取一律由 Cache 讀取
  19.  
  20. 2. Session 和 Cache 使用上的差別
  21. Session 主要用於儲存與 User 登入相關的資訊 (private 的緩存)
  22. Cache 是存放一些與 DB 查詢後相關的資訊,比如不需頻繁查詢的資訊 (public 的緩存)
  23.  
  24. 3. 使用 Redis 做 Cache 時, Redis:: 和 Cache:: 的差別
  25. 實際上跑起來沒有差別,但是使用 Cache:: 可以在未來使用其他模式(Memcached、DB)時只需修改 config 即可轉換
  26. Redis:: 則需重寫改為 Cache::
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement