Skip to content

Commit 3fd5061

Browse files
fix: remove unused functions and staticcheck SA3001 (lint CI)
1 parent f31bb28 commit 3fd5061

2 files changed

Lines changed: 0 additions & 59 deletions

File tree

internal/storage/basic_store.go

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -760,33 +760,6 @@ func (s *BasicStore) Close() error {
760760
return nil
761761
}
762762

763-
// evictForSpace tries to evict items to make space for new allocation (kept for backward compat)
764-
func (s *BasicStore) evictForSpace(neededSize uint64) error {
765-
// Evict expired items first
766-
expired := s.data.CollectExpired(func(item *CacheItem) bool { return item.IsExpired() })
767-
for _, key := range expired {
768-
_ = s.Delete(key)
769-
}
770-
if s.memPool.AvailableSpace() >= int64(neededSize) {
771-
return nil
772-
}
773-
774-
// Use eviction policy to find candidates
775-
for i := 0; i < 10 && s.memPool.AvailableSpace() < int64(neededSize); i++ {
776-
candidate := s.evictPolicy.NextEvictionCandidate()
777-
if candidate == nil {
778-
break
779-
}
780-
key := string(candidate.Key)
781-
_ = s.Delete(key)
782-
}
783-
784-
if s.memPool.AvailableSpace() < int64(neededSize) {
785-
return fmt.Errorf("unable to evict enough items to make space")
786-
}
787-
return nil
788-
}
789-
790763
// cleanupExpiredItems runs periodic cleanup of expired items
791764
func (s *BasicStore) cleanupExpiredItems() {
792765
ticker := time.NewTicker(s.config.CleanupInterval)
@@ -824,11 +797,6 @@ func (s *BasicStore) incrementErrorCount() {
824797
s.mutex.Unlock()
825798
}
826799

827-
// incrementErrorCountUnsafe increments error count without locking (caller must hold lock)
828-
func (s *BasicStore) incrementErrorCountUnsafe() {
829-
s.stats.ErrorCount++
830-
}
831-
832800
// itemToEntry converts a CacheItem to an Entry for the eviction policy
833801
func (s *BasicStore) itemToEntry(key string, item *CacheItem) *cache.Entry {
834802
// Get the actual value for the entry (used by eviction policy)
@@ -850,27 +818,3 @@ func (s *BasicStore) itemToEntry(key string, item *CacheItem) *cache.Entry {
850818
StoreID: s.config.Name,
851819
}
852820
}
853-
854-
// evictExpiredItemsSafe evicts expired items (thread-safe, uses ShardedMap)
855-
func (s *BasicStore) evictExpiredItemsSafe() uint64 {
856-
expired := s.data.CollectExpired(func(item *CacheItem) bool { return item.IsExpired() })
857-
for _, key := range expired {
858-
_ = s.Delete(key)
859-
}
860-
return uint64(len(expired))
861-
}
862-
863-
// evictLeastAccessedSafe evicts least accessed items (thread-safe)
864-
func (s *BasicStore) evictLeastAccessedSafe(count uint64) uint64 {
865-
evicted := uint64(0)
866-
for i := uint64(0); i < count; i++ {
867-
candidate := s.evictPolicy.NextEvictionCandidate()
868-
if candidate == nil {
869-
break
870-
}
871-
key := string(candidate.Key)
872-
_ = s.Delete(key)
873-
evicted++
874-
}
875-
return evicted
876-
}

tests/benchmarks/production_bench_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,6 @@ func BenchmarkConcurrencyScaling(b *testing.B) {
454454
}
455455

456456
b.SetParallelism(numG / runtime.GOMAXPROCS(0))
457-
if b.N < numG {
458-
b.N = numG
459-
}
460457
b.ResetTimer()
461458

462459
var ops int64

0 commit comments

Comments
 (0)