# I am the Watcher. I am your guide through this vast new twtiverse.
# 
# Usage:
#     https://watcher.sour.is/api/plain/users              View list of users and latest twt date.
#     https://watcher.sour.is/api/plain/twt                View all twts.
#     https://watcher.sour.is/api/plain/mentions?uri=:uri  View all mentions for uri.
#     https://watcher.sour.is/api/plain/conv/:hash         View all twts for a conversation subject.
# 
# Options:
#     uri     Filter to show a specific users twts.
#     offset  Start index for quey.
#     limit   Count of items to return (going back in time).
# 
# twt range = 1 1
# self = https://watcher.sour.is/conv/wlest5q
Go 的三種擴展原語之 — SingleFlight
概述singleflight.Group 是 Go 語言擴展包的另一種同步原語,它能夠在一個服務中抑制對下游的多次重複請求。一個比較常見的使用場景是,我們使用 Redis 對數據庫中的數據進行緩存,發生緩存擊穿時,大量請求會打到數據庫上進而影響服務的尾延時。而 singleflight.Group 能夠有效地解決這個問題,它能夠限制對同一個鍵值對的多次重複請求,減少對下游的瞬時流量。在資源的獲取非 ⌘ Read more