MCPcopy
hub / github.com/SciPhi-AI/R2R / get

Method get

py/core/providers/database/prompts_handler.py:46–61  ·  view source on GitHub ↗

Retrieve an item from cache.

(self, key: str)

Source from the content-addressed store, hash-verified

44 self._last_cleanup = datetime.now()
45
46 def get(self, key: str) -> Optional[T]:
47 """Retrieve an item from cache."""
48 self._maybe_cleanup()
49
50 if key not in self._cache:
51 return None
52
53 entry = self._cache[key]
54
55 if self._ttl and datetime.now() - entry.created_at > self._ttl:
56 del self._cache[key]
57 return None
58
59 entry.last_accessed = datetime.now()
60 entry.access_count += 1
61 return entry.value
62
63 def set(self, key: str, value: T) -> None:
64 """Store an item in cache."""

Callers 15

createMethod · 0.45
createSampleMethod · 0.45
main.pyFile · 0.45
logging_config.pyFile · 0.45
_execute_taskMethod · 0.45
_execute_task_syncMethod · 0.45
_execute_taskMethod · 0.45
_execute_task_syncMethod · 0.45
_execute_taskMethod · 0.45
_execute_task_syncMethod · 0.45

Calls 1

_maybe_cleanupMethod · 0.95

Tested by 15

find_by_short_idMethod · 0.36
arunMethod · 0.36
test_communitiesFunction · 0.36
test_document_chunkingFunction · 0.36
test_all_merged_configsFunction · 0.36
build_promptMethod · 0.36
format_contextMethod · 0.36
build_promptMethod · 0.36