Skip to content

Commit 7d98426

Browse files
committed
pkg/cdi: make registry use the default cache.
Make the registry use the default cache. Add a documentation note about future plans to obsolete and eventually remove the registry interface. Don't mark the registry obsoleted yet. Signed-off-by: Krisztian Litkey <[email protected]>
1 parent 825e123 commit 7d98426

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

pkg/cdi/doc.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
// available and instantiated the first time it is referenced directly
3636
// or indirectly. The most frequently used cache functions are available
3737
// as identically named package level functions which operate on the
38-
// default cache instance.
38+
// default cache instance. Moreover, the registry also operates on the
39+
// same default cache. We plan to deprecate the registry and eventually
40+
// remove it in a future release.
3941
//
4042
// # CDI Registry
4143
//

pkg/cdi/registry.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,12 @@ var (
122122
// GetRegistry returns the CDI registry. If any options are given, those
123123
// are applied to the registry.
124124
func GetRegistry(options ...Option) Registry {
125-
var new bool
126125
initOnce.Do(func() {
127-
reg = &registry{newCache(options...)}
128-
new = true
126+
reg = &registry{GetDefaultCache()}
129127
})
130-
if !new && len(options) > 0 {
128+
if len(options) > 0 {
131129
// We don't care about errors here
132130
_ = reg.Configure(options...)
133-
_ = reg.Refresh()
134131
}
135132
return reg
136133
}

0 commit comments

Comments
 (0)