Skip to content

Commit

Permalink
add Proxy#Key() func
Browse files Browse the repository at this point in the history
  • Loading branch information
mjc-gh committed Mar 10, 2024
1 parent 77cf600 commit 092c18c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ func (p *Proxy) watch(setter func() error) error {
return nil
}

func (p *Proxy) Key() string {
return p.key
}

// Get the key's current TTL. Redis is only called if the type was configured
// WithExpiry(). If no expiry is configured, a zero value Duration is returned
func (p *Proxy) TTL() (time.Duration, error) {
Expand Down
6 changes: 6 additions & 0 deletions proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ func (s *KredisTestSuite) TestNewProxyWithExpiresIn() {
s.NoError(e)
s.Equal(75*time.Second, p.expiresIn)
}

func (s *KredisTestSuite) TestProxyKey() {
p, _ := NewProxy("key")

s.Equal("ns:key", p.Key())
}

0 comments on commit 092c18c

Please sign in to comment.