缓存适配
v1.14.0
新版本特性。
gcache
模块采用了适配器设计模式,提供了Adapter
适配器接口,任何实现了Adapter
接口的对象均可注册到缓存管理对象中,使得开发者可以对缓存管理对象进行灵活的扩展。
...
// 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)
具体示例请参考【Redis缓存】章节。