W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
緩存組件采用了接口化設(shè)計(jì),提供了?Adapter
?接口,任何實(shí)現(xiàn)了?Adapter
?接口的對(duì)象均可注冊(cè)到緩存管理對(duì)象中,使得開發(fā)者可以對(duì)緩存管理對(duì)象進(jìn)行靈活的自定義實(shí)現(xiàn)和擴(kuò)展。
?Adapter
?接口定義如下:
https://pkg.go.dev/github.com/gogf/gf/v2/os/gcache#Adapter
通過該方法將實(shí)現(xiàn)的?adapter
?應(yīng)用到對(duì)應(yīng)的?Cache
?對(duì)象上:
// SetAdapter changes the adapter for this cache.
// Be very note that, this setting function is not concurrent-safe, which means you should not call
// this setting function concurrently in multiple goroutines.
func (c *Cache) SetAdapter(adapter Adapter)
通過該方法獲取當(dāng)前注冊(cè)的?adapter
?接口實(shí)現(xiàn)對(duì)象上:
// GetAdapter returns the adapter that is set in current Cache.
func (c *Cache) GetAdapter() Adapter
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: