@@ -24,14 +24,17 @@ func NewCacheBackend(config CacheConfig) (CacheBackend, error) {
2424 switch config .BackendType {
2525 case InMemoryCacheType , "" :
2626 // Use in-memory cache as the default backend
27- observability .Debugf ("Creating in-memory cache backend - MaxEntries: %d, TTL: %ds, Threshold: %.3f" ,
28- config .MaxEntries , config .TTLSeconds , config .SimilarityThreshold )
27+ observability .Debugf ("Creating in-memory cache backend - MaxEntries: %d, TTL: %ds, Threshold: %.3f, UseHNSW: %t " ,
28+ config .MaxEntries , config .TTLSeconds , config .SimilarityThreshold , config . UseHNSW )
2929 options := InMemoryCacheOptions {
3030 Enabled : config .Enabled ,
3131 SimilarityThreshold : config .SimilarityThreshold ,
3232 MaxEntries : config .MaxEntries ,
3333 TTLSeconds : config .TTLSeconds ,
3434 EvictionPolicy : config .EvictionPolicy ,
35+ UseHNSW : config .UseHNSW ,
36+ HNSWM : config .HNSWM ,
37+ HNSWEfConstruction : config .HNSWEfConstruction ,
3538 }
3639 return NewInMemoryCache (options ), nil
3740
@@ -46,6 +49,20 @@ func NewCacheBackend(config CacheConfig) (CacheBackend, error) {
4649 }
4750 return NewMilvusCache (options )
4851
52+ case HybridCacheType :
53+ observability .Debugf ("Creating Hybrid cache backend - MaxMemory: %d, TTL: %ds, Threshold: %.3f" ,
54+ config .MaxMemoryEntries , config .TTLSeconds , config .SimilarityThreshold )
55+ options := HybridCacheOptions {
56+ Enabled : config .Enabled ,
57+ SimilarityThreshold : config .SimilarityThreshold ,
58+ TTLSeconds : config .TTLSeconds ,
59+ MaxMemoryEntries : config .MaxMemoryEntries ,
60+ HNSWM : config .HNSWM ,
61+ HNSWEfConstruction : config .HNSWEfConstruction ,
62+ MilvusConfigPath : config .BackendConfigPath ,
63+ }
64+ return NewHybridCache (options )
65+
4966 default :
5067 observability .Debugf ("Unsupported cache backend type: %s" , config .BackendType )
5168 return nil , fmt .Errorf ("unsupported cache backend type: %s" , config .BackendType )
0 commit comments