代码拉取完成,页面将自动刷新
package features
import (
"gitee.com/quant1x/engine/cache"
"gitee.com/quant1x/engine/cachel5"
"sync"
)
var (
__l5Once sync.Once
// 扩展交易特征
__l5Exchange *cachel5.Cache1D[*Exchange] = nil
// 平台
__l5Box *cachel5.Cache1D[*Box] = nil
)
func init() {
__l5Once.Do(lazyInitFeatures)
}
func lazyInitFeatures() {
// 扩展信息
__l5Exchange = cachel5.NewCache1D[*Exchange](CacheL5KeyExchange, NewExchange)
err := cache.Register(__l5Exchange)
if err != nil {
panic(err)
}
// 平台
__l5Box = cachel5.NewCache1D[*Box](CacheL5KeyBox, NewBox)
err = cache.Register(__l5Box)
if err != nil {
panic(err)
}
}
func CacheExchange() *cachel5.Cache1D[*Exchange] {
__l5Once.Do(lazyInitFeatures)
return __l5Exchange
}
// GetL5Exchange 获取扩展信息
func GetL5Exchange(securityCode string, date ...string) (exchange *Exchange) {
__l5Once.Do(lazyInitFeatures)
v := __l5Exchange.Get(securityCode, date...)
if v == nil {
return nil
}
return *v
}
// UpdateL5Exchange 更新当日exchange
func UpdateL5Exchange(extension *Exchange) {
__l5Once.Do(lazyInitFeatures)
__l5Exchange.Set(extension.Code, extension, cache.DefaultCanReadDate())
}
// RefreshL5Exchange 刷新缓存
func RefreshL5Exchange() {
__l5Once.Do(lazyInitFeatures)
__l5Exchange.Apply(nil)
}
func CacheBox() *cachel5.Cache1D[*Box] {
__l5Once.Do(lazyInitFeatures)
return __l5Box
}
// GetL5Box 获取平台数据
func GetL5Box(securityCode string, date ...string) *Box {
__l5Once.Do(lazyInitFeatures)
v := __l5Box.Get(securityCode, date...)
if v == nil {
return nil
}
return *v
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。