MCPcopy
hub / github.com/ray-project/ray / add

Method add

python/ray/_private/runtime_env/uri_cache.py:76–86  ·  view source on GitHub ↗

Add a URI to the cache and mark it as in use.

(self, uri: str, size_bytes: int, logger: logging.Logger = default_logger)

Source from the content-addressed store, hash-verified

74 self._check_valid()
75
76 def add(self, uri: str, size_bytes: int, logger: logging.Logger = default_logger):
77 """Add a URI to the cache and mark it as in use."""
78 if uri in self._unused_uris:
79 self._unused_uris.remove(uri)
80
81 self._used_uris.add(uri)
82 self._total_size_bytes += size_bytes
83
84 self._evict_if_needed(logger)
85 self._check_valid()
86 logger.info(f"Added URI {uri} with size {size_bytes}")
87
88 def get_total_size_bytes(self) -> int:
89 return self._total_size_bytes

Callers 15

test_zero_cache_sizeMethod · 0.95
test_mark_usedMethod · 0.95
test_many_URIsMethod · 0.95
test_delete_fn_calledMethod · 0.95
run_background_taskFunction · 0.45
fetch_prometheusFunction · 0.45
test_library_usagesFunction · 0.45
_get_usage_setFunction · 0.45
record_library_usageFunction · 0.45
_find_address_from_flagFunction · 0.45

Calls 4

_evict_if_neededMethod · 0.95
_check_validMethod · 0.95
removeMethod · 0.65
infoMethod · 0.45

Tested by 8

test_zero_cache_sizeMethod · 0.76
test_mark_usedMethod · 0.76
test_many_URIsMethod · 0.76
test_delete_fn_calledMethod · 0.76
fetch_prometheusFunction · 0.36
test_library_usagesFunction · 0.36
runMethod · 0.36