Skip to content

Commit daef21d

Browse files
committed
refactor: split cache pkg into two packages. One for Interface & one for implementation
1 parent a7c8968 commit daef21d

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

pkg/cache/cache.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package cache
2+
3+
type ICache interface {
4+
Get(string) string
5+
Set(string, string)
6+
}

pkg/cache/lru.go renamed to pkg/lru/lru.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package lru
22

3-
import "sync"
3+
import (
4+
"sync"
5+
6+
"github.com/Oudwins/tailwind-merge-go/pkg/cache"
7+
)
48

59
type node struct {
610
key string
@@ -9,11 +13,6 @@ type node struct {
913
next *node
1014
}
1115

12-
type Cache interface {
13-
Get(string) string
14-
Set(string, string)
15-
}
16-
1716
type LRU struct {
1817
maxCapacity int
1918
capacity int
@@ -81,7 +80,7 @@ func (lru *LRU) remove(n *node) {
8180
lru.capacity--
8281
}
8382

84-
func Make(maxCapacity int) Cache {
83+
func Make(maxCapacity int) cache.ICache {
8584
head := &node{}
8685
tail := &node{}
8786
tail.next = head

0 commit comments

Comments
 (0)