Commit 62dc045
authored
Fix LangCache clear() 400 error by using flush() API (#428)
Fix LangCache clear() 400 error by using flush() API
## Summary
The LangCache API returns `400 Bad Request: "attributes: cannot be
blank"` when `clear()` attempts to delete all entries by passing
`attributes={}` to `delete_query()`. The fix uses the LangCache SDK's
dedicated `flush()` method to properly delete all entries.
## Changes
### Core Fix
- **`delete()` and `adelete()`** - Now call `self._client.flush()` and
`self._client.flush_async()` respectively to delete all cache entries
using the proper API endpoint.
### Additional Improvements
- **`delete_by_attributes()` and `adelete_by_attributes()`** - Now raise
`ValueError` if called with an empty attributes dictionary. This
prevents misuse and provides a clear error message: "Cannot delete by
attributes with an empty attributes dictionary." Users should use
`delete()` or `clear()` to delete all entries, or provide specific
attributes to filter deletions.
- Fixes #4271 parent c61c8c7 commit 62dc045
File tree
2 files changed
+138
-11
lines changed- redisvl/extensions/cache/llm
- tests/unit
2 files changed
+138
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
536 | 536 | | |
537 | 537 | | |
538 | 538 | | |
539 | | - | |
540 | | - | |
| 539 | + | |
541 | 540 | | |
542 | | - | |
| 541 | + | |
543 | 542 | | |
544 | 543 | | |
545 | 544 | | |
546 | 545 | | |
547 | | - | |
548 | | - | |
| 546 | + | |
549 | 547 | | |
550 | | - | |
| 548 | + | |
551 | 549 | | |
552 | 550 | | |
553 | 551 | | |
| |||
584 | 582 | | |
585 | 583 | | |
586 | 584 | | |
| 585 | + | |
587 | 586 | | |
588 | 587 | | |
589 | 588 | | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
590 | 592 | | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
591 | 597 | | |
592 | 598 | | |
593 | 599 | | |
| |||
597 | 603 | | |
598 | 604 | | |
599 | 605 | | |
| 606 | + | |
600 | 607 | | |
601 | 608 | | |
602 | 609 | | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
603 | 613 | | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
604 | 618 | | |
605 | 619 | | |
606 | 620 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
358 | | - | |
| 358 | + | |
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
| 370 | + | |
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
374 | | - | |
| 374 | + | |
375 | 375 | | |
376 | 376 | | |
377 | | - | |
| 377 | + | |
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
389 | 422 | | |
390 | 423 | | |
391 | 424 | | |
| |||
402 | 435 | | |
403 | 436 | | |
404 | 437 | | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
405 | 518 | | |
406 | 519 | | |
407 | 520 | | |
| |||
0 commit comments