Skip to content

Commit

Permalink
Optimize Ristretto cache configuration
Browse files Browse the repository at this point in the history
Reorder imports in `config.go` for clarity and include buffer items and metrics setting in the Ristretto cache configuration for improved performance and monitoring.
  • Loading branch information
Koopa0 committed Oct 8, 2024
1 parent 69cf32b commit 7403b3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions internal/cache/limited/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ func NewRistrettoStore(maxSize uint64, defaultTTL time.Duration, logger *zap.Log
c, err := ristretto.NewCache(&ristretto.Config[string, any]{
NumCounters: numCounters,
MaxCost: maxCost,
BufferItems: 64,
Metrics: true,
})
if err != nil {
return nil, fmt.Errorf("failed to create Ristretto cache: %w", err)
Expand Down
3 changes: 2 additions & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package config

import (
"errors"
"github.com/redis/go-redis/v9"
"io"
"math"
"runtime"
"time"

"github.com/redis/go-redis/v9"
"github.com/sony/gobreaker"
"go.uber.org/zap"

"goflare.io/ember/pkg/serialization"
)

Expand Down

0 comments on commit 7403b3b

Please sign in to comment.