55 "time"
66
77 "github.com/dgraph-io/ristretto/v2"
8+ "go.uber.org/zap"
89 "google.golang.org/protobuf/proto"
910
1011 api_common "github.com/ydb-platform/fq-connector-go/api/common"
@@ -23,7 +24,7 @@ type ristrettoCache struct {
2324 ttl time.Duration
2425}
2526
26- func (r * ristrettoCache ) Put (dsi * api_common.TGenericDataSourceInstance , tableName string , value * TValue ) bool {
27+ func (r * ristrettoCache ) Put (_ * zap. Logger , dsi * api_common.TGenericDataSourceInstance , tableName string , value * TValue ) bool {
2728 key := serializeKey (dsi , tableName )
2829
2930 // Serialize TValue to bytes
@@ -35,7 +36,7 @@ func (r *ristrettoCache) Put(dsi *api_common.TGenericDataSourceInstance, tableNa
3536 return r .cache .SetWithTTL (key , data , int64 (len (data )), r .ttl )
3637}
3738
38- func (r * ristrettoCache ) Get (dsi * api_common.TGenericDataSourceInstance , tableName string ) (* TValue , bool ) {
39+ func (r * ristrettoCache ) Get (_ * zap. Logger , dsi * api_common.TGenericDataSourceInstance , tableName string ) (* TValue , bool ) {
3940 key := serializeKey (dsi , tableName )
4041
4142 data , found := r .cache .Get (key )
@@ -77,9 +78,9 @@ func (r *ristrettoCache) Metrics() *Metrics {
7778
7879func newRistrettoCache (cfg * config.TYdbConfig_TTableMetadataCache ) (* ristrettoCache , error ) {
7980 cache , err := ristretto .NewCache (& ristretto.Config [string , []byte ]{
80- NumCounters : cfg .GetRistretto ().NumCounters ,
81- MaxCost : cfg .GetRistretto ().MaxCost ,
82- BufferItems : cfg . GetRistretto (). BufferItems ,
81+ NumCounters : cfg .GetRistretto ().MaxKeys ,
82+ MaxCost : cfg .GetRistretto ().MaxSizeBytes ,
83+ BufferItems : 64 , // reasonable default
8384 Metrics : true ,
8485 })
8586
0 commit comments