MCPcopy
hub / github.com/vibrantlabsai/ragas / sync_wrapper

Function sync_wrapper

src/ragas/cache.py:235–245  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

233
234 @functools.wraps(func)
235 def sync_wrapper(*args, **kwargs):
236 cache_key = _generate_cache_key(func, args, kwargs)
237
238 if backend.has_key(cache_key):
239 logger.debug(f"Cache hit for {cache_key}")
240 return backend.get(cache_key)
241
242 result = func(*args, **kwargs)
243 picklable_result = _make_pydantic_picklable(result)
244 backend.set(cache_key, picklable_result)
245 return result
246
247 return async_wrapper if is_async else sync_wrapper
248

Callers

nothing calls this directly

Calls 5

_generate_cache_keyFunction · 0.85
_make_pydantic_picklableFunction · 0.85
has_keyMethod · 0.45
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…