# 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/tyslfaq
go 單例實現—雙重檢測是否安全**
起因今天看到項目中的 kafka 客戶端包裝結構體的獲取是單例模式 br 單例的實現是老生常談的問題了,懶漢餓漢線程安全,因爲看到項目中寫的還是有些問題,網上 go 單例實現的搜索結果比較少經測試也並不靠譜,所以在這記錄下現狀當前有的項目直接使用 Mutex 鎖,有的就直接判斷 nil 則創建,對於前者,每次都加鎖性能差,對於後者則會出現多個實例,也就不是單例了改進進而想要改進一下,在這不討論餓漢 ⌘ Read more