mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
fix: [GoSDK] reset cache after UsingDatabase (#35638)
Related to milvus-io/milvus-sdk-go#809 --------- Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
69265978bf
commit
4373c6994f
@ -202,6 +202,9 @@ func (c *Client) connectInternal(ctx context.Context) error {
|
||||
|
||||
c.config.setServerInfo(resp.GetServerInfo().GetBuildTags())
|
||||
c.setIdentifier(strconv.FormatInt(resp.GetIdentifier(), 10))
|
||||
if c.collCache != nil {
|
||||
c.collCache.Reset()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -32,6 +32,11 @@ func (c *CollectionCache) GetCollection(ctx context.Context, collName string) (*
|
||||
return coll, err
|
||||
}
|
||||
|
||||
// Reset clears all cached info, used when client switching env.
|
||||
func (c *CollectionCache) Reset() {
|
||||
c.collections = typeutil.NewConcurrentMap[string, *entity.Collection]()
|
||||
}
|
||||
|
||||
func NewCollectionCache(fetcher func(context.Context, string) (*entity.Collection, error)) *CollectionCache {
|
||||
return &CollectionCache{
|
||||
collections: typeutil.NewConcurrentMap[string, *entity.Collection](),
|
||||
|
||||
@ -41,13 +41,13 @@ func (idx hnswIndex) Params() map[string]string {
|
||||
}
|
||||
}
|
||||
|
||||
func NewHNSWIndex(metricType MetricType, M int, efConstruction int) Index {
|
||||
func NewHNSWIndex(metricType MetricType, m int, efConstruction int) Index {
|
||||
return hnswIndex{
|
||||
baseIndex: baseIndex{
|
||||
metricType: metricType,
|
||||
indexType: HNSW,
|
||||
},
|
||||
m: M,
|
||||
m: m,
|
||||
efConstruction: efConstruction,
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user