Skip to content

Commit

Permalink
fix cache
Browse files Browse the repository at this point in the history
  • Loading branch information
iesreza committed Nov 29, 2023
1 parent c870162 commit ef44274
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/cache/drivers/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ var unmarshaller func(bytes []byte, out interface{}) error = binary.Unmarshal

type driver struct{}

func (d driver) SetPrefix(p string) {
return
}

var items sync.Map

func (driver) Register() error {
Expand Down
4 changes: 4 additions & 0 deletions lib/cache/drivers/redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,7 @@ func toInt64(n interface{}) int64 {
}
return 0
}

func (d driver) SetPrefix(p string) {
prefix = p
}
4 changes: 4 additions & 0 deletions lib/cache/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,7 @@ func Register() error {
func DefaultDriver() Interface {
return defaultDriver
}

func SetPrefix(prefix string) {
defaultDriver.SetPrefix(prefix)
}
3 changes: 3 additions & 0 deletions lib/cache/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,7 @@ type Interface interface {

// SetUnMarshaller set []byte to interface{} unmarshalling function
SetUnMarshaller(func(bytes []byte, out interface{}) error)

// SetPrefix set a key prefix
SetPrefix(p string)
}

0 comments on commit ef44274

Please sign in to comment.