Skip to content

Commit 09bf5fe

Browse files
authored
make some combined cache configs accesible (#49)
1 parent 535f438 commit 09bf5fe

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

pkg/zcache/combined_cache_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ func (suite *CombinedCacheTestSuite) SetupSuite() {
3636
Remote: &RemoteConfig{
3737
Addr: "0.0.0.0",
3838
},
39-
isRemoteBestEffort: true,
40-
globalPrefix: prefix,
39+
IsRemoteBestEffort: true,
40+
GlobalPrefix: prefix,
4141
})
4242
suite.Nil(err)
4343

@@ -48,8 +48,8 @@ func (suite *CombinedCacheTestSuite) SetupSuite() {
4848
Remote: &RemoteConfig{
4949
Addr: mr.Addr(),
5050
},
51-
isRemoteBestEffort: false,
52-
globalPrefix: prefix,
51+
IsRemoteBestEffort: false,
52+
GlobalPrefix: prefix,
5353
})
5454
suite.Nil(err)
5555

@@ -61,8 +61,8 @@ func (suite *CombinedCacheTestSuite) SetupSuite() {
6161
Remote: &RemoteConfig{
6262
Addr: "0.0.0.0",
6363
},
64-
isRemoteBestEffort: false,
65-
globalPrefix: prefix,
64+
IsRemoteBestEffort: false,
65+
GlobalPrefix: prefix,
6666
})
6767
suite.Nil(err)
6868
}

pkg/zcache/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (c *LocalConfig) ToBigCacheConfig() bigcache.Config {
5353
type CombinedConfig struct {
5454
Local *LocalConfig
5555
Remote *RemoteConfig
56-
globalTtlSeconds int
57-
globalPrefix string
58-
isRemoteBestEffort bool
56+
GlobalTtlSeconds int
57+
GlobalPrefix string
58+
IsRemoteBestEffort bool
5959
}

pkg/zcache/zcache.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ func NewCombinedCache(combinedConfig *CombinedConfig) (CombinedCache, error) {
3838
remoteCacheConfig := combinedConfig.Remote
3939

4040
// Set global configs on remote cache config
41-
remoteCacheConfig.Prefix = combinedConfig.globalPrefix
41+
remoteCacheConfig.Prefix = combinedConfig.GlobalPrefix
4242
remoteClient, err := NewRemoteCache(remoteCacheConfig)
4343
if err != nil {
4444
return nil, err
4545
}
4646

4747
// Set global configs on local cache config
48-
localCacheConfig.EvictionInSeconds = combinedConfig.globalTtlSeconds
49-
localCacheConfig.Prefix = combinedConfig.globalPrefix
48+
localCacheConfig.EvictionInSeconds = combinedConfig.GlobalTtlSeconds
49+
localCacheConfig.Prefix = combinedConfig.GlobalPrefix
5050
localClient, err := NewLocalCache(localCacheConfig)
5151
if err != nil {
5252
return nil, err
@@ -55,7 +55,7 @@ func NewCombinedCache(combinedConfig *CombinedConfig) (CombinedCache, error) {
5555
return &combinedCache{
5656
remoteCache: remoteClient,
5757
localCache: localClient,
58-
isRemoteBestEffort: combinedConfig.isRemoteBestEffort,
59-
ttl: time.Duration(combinedConfig.globalTtlSeconds) * time.Second,
58+
isRemoteBestEffort: combinedConfig.IsRemoteBestEffort,
59+
ttl: time.Duration(combinedConfig.GlobalTtlSeconds) * time.Second,
6060
}, nil
6161
}

0 commit comments

Comments
 (0)