新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)GoFrame教程:GoFrame 緩存管理-接口化設(shè)計
緩存組件采用了接口化設(shè)計,提供了?Adapter?接口,任何實現(xiàn)了?Adapter?接口的對象均可注冊到緩存管理對象中,使得開發(fā)者可以對緩存管理對象進(jìn)行靈活的自定義實現(xiàn)和擴展。

網(wǎng)站設(shè)計制作過程拒絕使用模板建站;使用PHP+MYSQL原生開發(fā)可交付網(wǎng)站源代碼;符合網(wǎng)站優(yōu)化排名的后臺管理系統(tǒng);成都網(wǎng)站制作、成都網(wǎng)站建設(shè)收費合理;免費進(jìn)行網(wǎng)站備案等企業(yè)網(wǎng)站建設(shè)一條龍服務(wù).我們是一家持續(xù)穩(wěn)定運營了十余年的創(chuàng)新互聯(lián)建站網(wǎng)站建設(shè)公司。
接口定義
?Adapter?接口定義如下:
https://pkg.GO.dev/github.com/gogf/gf/v2/os/gcache#Adapter
注冊接口實現(xiàn)
通過該方法將實現(xiàn)的?adapter?應(yīng)用到對應(yīng)的?Cache?對象上:
// 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)獲取接口實現(xiàn)
通過該方法獲取當(dāng)前注冊的?adapter?接口實現(xiàn)對象上:
// GetAdapter returns the adapter that is set in current Cache.
func (c *Cache) GetAdapter() Adapter 網(wǎng)站標(biāo)題:創(chuàng)新互聯(lián)GoFrame教程:GoFrame 緩存管理-接口化設(shè)計
URL鏈接:http://m.fisionsoft.com.cn/article/dhgcjsh.html


咨詢
建站咨詢
