Skip to content

Commit 0dd5faf

Browse files
committed
refactor: rename cache package from v4 to v2
Rename the cache concurrent map package from v4 to v2 to better reflect the actual version or align with project versioning strategy. Changes: - Move pkg/cache/v4/cmap.go to pkg/cache/v2/cmap.go - Update package declaration from v4 to cachev2 - Update import alias from cachev4 to cachev2 in backend/inmemory.go - Update all references to use the new package name This change maintains all existing functionality while correcting the package versioning to match the intended version number.
1 parent ebcb805 commit 0dd5faf

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

backend/inmemory.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@ import (
77
"github.com/hyp3rd/hypercache/internal/constants"
88
"github.com/hyp3rd/hypercache/internal/sentinel"
99
"github.com/hyp3rd/hypercache/pkg/cache"
10-
cachev4 "github.com/hyp3rd/hypercache/pkg/cache/v4"
10+
cachev2 "github.com/hyp3rd/hypercache/pkg/cache/v2"
1111
)
1212

1313
// InMemory is a cache backend that stores the items in memory, leveraging a custom `ConcurrentMap`.
1414
type InMemory struct {
1515
sync.RWMutex // mutex to protect the cache from concurrent access
1616

17-
items cachev4.ConcurrentMap // map to store the items in the cache
17+
items cachev2.ConcurrentMap // map to store the items in the cache
1818
itemPoolManager *cache.ItemPoolManager // item pool manager to manage the item pool
1919
capacity int // capacity of the cache, limits the number of items that can be stored in the cache
2020
}
2121

2222
// NewInMemory creates a new in-memory cache with the given options.
2323
func NewInMemory(opts ...Option[InMemory]) (IBackend[InMemory], error) {
2424
InMemory := &InMemory{
25-
items: cachev4.New(),
25+
items: cachev2.New(),
2626
itemPoolManager: cache.NewItemPoolManager(),
2727
}
2828
// Apply the backend options
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// if item, ok := cm.Get("key"); ok {
2020
// // Process item
2121
// }
22-
package v4
22+
package cachev2
2323

2424
import (
2525
"hash"

0 commit comments

Comments
 (0)