diff --git a/pkg/stores/partition/store.go b/pkg/stores/partition/store.go index 185a6cb..4c25022 100644 --- a/pkg/stores/partition/store.go +++ b/pkg/stores/partition/store.go @@ -29,7 +29,7 @@ const ( // Not related to the total size in memory of the cache, as any item could take any amount of memory. cacheSizeEnv = "CATTLE_REQUEST_CACHE_SIZE_INT" defaultCacheSize = 1000 - // Set to non-empty to disable list request caching entirely. + // Set to "false" to enable list request caching. cacheDisableEnv = "CATTLE_REQUEST_CACHE_DISABLED" ) @@ -60,7 +60,7 @@ func NewStore(partitioner Partitioner, asl accesscontrol.AccessSetLookup) *Store Partitioner: partitioner, asl: asl, } - if v := os.Getenv(cacheDisableEnv); v == "" { + if v := os.Getenv(cacheDisableEnv); v == "false" { s.listCache = cache.NewLRUExpireCache(cacheSize) } return s diff --git a/pkg/stores/partition/store_test.go b/pkg/stores/partition/store_test.go index fdd666c..a139db0 100644 --- a/pkg/stores/partition/store_test.go +++ b/pkg/stores/partition/store_test.go @@ -1941,8 +1941,8 @@ func TestList(t *testing.T) { } } asl := &mockAccessSetLookup{userRoles: test.access} - if test.disableCache { - t.Setenv("CATTLE_REQUEST_CACHE_DISABLED", "Y") + if !test.disableCache { + t.Setenv("CATTLE_REQUEST_CACHE_DISABLED", "false") } store := NewStore(mockPartitioner{ stores: stores, @@ -2024,7 +2024,6 @@ func TestListByRevision(t *testing.T) { }, }, asl) req := newRequest("", "user1") - t.Setenv("CATTLE_REQUEST_CACHE_DISABLED", "Y") got, gotErr := store.List(req, schema) assert.Nil(t, gotErr)