File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
sdk/python/feast/infra/registry Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,31 @@ def wrapper(
7171 return wrapper
7272
7373
74+ def registry_proto_cache_name (func ):
75+ cache_proto_key = None
76+ cache = {}
77+
78+ @wraps (func )
79+ def wrapper (registry_proto : RegistryProto , name : str , project : str ):
80+ nonlocal cache_proto_key , cache
81+
82+ proto_key = (id (registry_proto ), registry_proto .version_id )
83+
84+ if proto_key != cache_proto_key :
85+ cache = {}
86+ cache_proto_key = proto_key
87+
88+ key = (project , name )
89+ if key in cache :
90+ return cache [key ]
91+ else :
92+ value = func (registry_proto , name , project )
93+ cache [key ] = value
94+ return value
95+
96+ return wrapper
97+
98+
7499def get_project_metadata (
75100 registry_proto : Optional [RegistryProto ], project : str
76101) -> Optional [ProjectMetadataProto ]:
@@ -94,6 +119,7 @@ def get_feature_service(
94119 raise FeatureServiceNotFoundException (name , project = project )
95120
96121
122+ @registry_proto_cache_name
97123def get_any_feature_view (
98124 registry_proto : RegistryProto , name : str , project : str
99125) -> BaseFeatureView :
You can’t perform that action at this time.
0 commit comments