database: fix feature version cache
This commit is contained in:
parent
40a7c8a00d
commit
35df7ca0eb
@ -67,10 +67,10 @@ func (pgSQL *pgSQL) insertFeatureVersion(featureVersion database.FeatureVersion)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do cache lookup.
|
// Do cache lookup.
|
||||||
|
cacheIndex := "featureversion:" + featureVersion.Feature.Namespace.Name + ":" + featureVersion.Feature.Name + ":" + featureVersion.Version.String()
|
||||||
if pgSQL.cache != nil {
|
if pgSQL.cache != nil {
|
||||||
promCacheQueriesTotal.WithLabelValues("featureversion").Inc()
|
promCacheQueriesTotal.WithLabelValues("featureversion").Inc()
|
||||||
id, found := pgSQL.cache.Get("featureversion:" + featureVersion.Feature.Namespace.Name + ":" +
|
id, found := pgSQL.cache.Get(cacheIndex)
|
||||||
featureVersion.Feature.Name + ":" + featureVersion.Version.String())
|
|
||||||
if found {
|
if found {
|
||||||
promCacheHitsTotal.WithLabelValues("featureversion").Inc()
|
promCacheHitsTotal.WithLabelValues("featureversion").Inc()
|
||||||
return id.(int), nil
|
return id.(int), nil
|
||||||
@ -148,8 +148,7 @@ func (pgSQL *pgSQL) insertFeatureVersion(featureVersion database.FeatureVersion)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if pgSQL.cache != nil {
|
if pgSQL.cache != nil {
|
||||||
pgSQL.cache.Add("featureversion:"+featureVersion.Feature.Name+":"+
|
pgSQL.cache.Add(cacheIndex, featureVersion.ID)
|
||||||
featureVersion.Feature.Namespace.Name+":"+featureVersion.Version.String(), featureVersion.ID)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return featureVersion.ID, nil
|
return featureVersion.ID, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user