-
Notifications
You must be signed in to change notification settings - Fork 62
Fix LangCache clear() 400 error by using flush() API #428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
19b96e2
9d33cd0
8d2549e
5d02f58
cd08209
cf800f9
414ad66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -536,18 +536,16 @@ async def aupdate(self, key: str, **kwargs) -> None: | |
| def delete(self) -> None: | ||
| """Delete the entire cache. | ||
|
|
||
| This deletes all entries in the cache by calling delete_query | ||
| with no attributes. | ||
| This deletes all entries in the cache by calling the flush API. | ||
| """ | ||
| self._client.delete_query(attributes={}) | ||
| self._client.flush() | ||
|
|
||
| async def adelete(self) -> None: | ||
| """Async delete the entire cache. | ||
|
|
||
| This deletes all entries in the cache by calling delete_query | ||
| with no attributes. | ||
| This deletes all entries in the cache by calling the flush API. | ||
| """ | ||
| await self._client.delete_query_async(attributes={}) | ||
| await self._client.flush_async() | ||
|
|
||
| def clear(self) -> None: | ||
| """Clear the cache of all entries. | ||
|
|
@@ -584,10 +582,14 @@ def delete_by_attributes(self, attributes: Dict[str, Any]) -> Dict[str, Any]: | |
|
|
||
| Args: | ||
| attributes (Dict[str, Any]): Attributes to match for deletion. | ||
| If empty, no deletion is performed. | ||
|
|
||
| Returns: | ||
| Dict[str, Any]: Result of the deletion operation. | ||
| """ | ||
| if not attributes: | ||
| # No attributes provided, return result with zero deletions | ||
| return {"deleted_entries_count": 0} | ||
| result = self._client.delete_query(attributes=attributes) | ||
| # Convert DeleteQueryResponse to dict | ||
| return result.model_dump() if hasattr(result, "model_dump") else {} | ||
|
|
@@ -597,10 +599,14 @@ async def adelete_by_attributes(self, attributes: Dict[str, Any]) -> Dict[str, A | |
|
|
||
| Args: | ||
| attributes (Dict[str, Any]): Attributes to match for deletion. | ||
| If empty, no deletion is performed. | ||
|
|
||
| Returns: | ||
| Dict[str, Any]: Result of the deletion operation. | ||
| """ | ||
| if not attributes: | ||
| # No attributes provided, return result with zero deletions | ||
| return {"deleted_entries_count": 0} | ||
abrookins marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| result = await self._client.delete_query_async(attributes=attributes) | ||
| # Convert DeleteQueryResponse to dict | ||
| return result.model_dump() if hasattr(result, "model_dump") else {} | ||
Uh oh!
There was an error while loading. Please reload this page.