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(
71
71
return wrapper
72
72
73
73
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
+
74
99
def get_project_metadata (
75
100
registry_proto : Optional [RegistryProto ], project : str
76
101
) -> Optional [ProjectMetadataProto ]:
@@ -94,6 +119,7 @@ def get_feature_service(
94
119
raise FeatureServiceNotFoundException (name , project = project )
95
120
96
121
122
+ @registry_proto_cache_name
97
123
def get_any_feature_view (
98
124
registry_proto : RegistryProto , name : str , project : str
99
125
) -> BaseFeatureView :
You can’t perform that action at this time.
0 commit comments