Skip to content

Commit c250e72

Browse files
author
jose.castillo
committed
feature: expose CacheStats and GroupStats
1 parent 0a27ce5 commit c250e72

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

group.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ type Group interface {
3939
Remove(context.Context, string) error
4040
UsedBytes() (int64, int64)
4141
Name() string
42+
ExportCacheStats(CacheType) CacheStats
43+
ExportGroupStats() GroupStats
4244
}
4345

4446
// A Getter loads data for a key.
@@ -110,6 +112,14 @@ func (g *group) UsedBytes() (mainCache int64, hotCache int64) {
110112
return g.mainCache.Bytes(), g.hotCache.Bytes()
111113
}
112114

115+
func (g *group) ExportCacheStats(which CacheType) CacheStats {
116+
return g.CacheStats(which)
117+
}
118+
119+
func (g *group) ExportGroupStats() GroupStats {
120+
return g.Stats
121+
}
122+
113123
func (g *group) Get(ctx context.Context, key string, dest transport.Sink) error {
114124
g.Stats.Gets.Add(1)
115125
if dest == nil {

0 commit comments

Comments
 (0)