Commit eb44628
committed
Fix variable expiration with async cache (fixes #159)
An in-flight future was mistakenly given the maximum expiry allowed,
causing it to not honor an expire-after-create setting. Instead it was
supposed to be beyond the maximum to signal adaption on the completion
update.
The calculations for fixed expiration was made more robust to the time
rolling over. This now complies with System.nanoTime() warnings.
Strengthened the remove and replace operations to be more predictably
linearizable. This removed optimizations to avoid unnecessary work by
checking if the entry was present in a lock-free manner. Since the hash
table supresses loads until complete, that might mean that a call to
remove a loading entry was not performed. The contract allows either,
so the optimization is left to user code and gives preference to those
who need the linearizable behavior. (See #156)1 parent abf9add commit eb44628
File tree
8 files changed
+365
-106
lines changed- caffeine/src
- main/java/com/github/benmanes/caffeine/cache
- test/java/com/github/benmanes/caffeine/cache
- testing
- gradle
- guava/src/test/java/com/google/common/cache
8 files changed
+365
-106
lines changedLines changed: 17 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
678 | 678 | | |
679 | 679 | | |
680 | 680 | | |
681 | | - | |
682 | | - | |
| 681 | + | |
683 | 682 | | |
684 | | - | |
685 | | - | |
| 683 | + | |
| 684 | + | |
686 | 685 | | |
687 | 686 | | |
688 | 687 | | |
689 | 688 | | |
690 | 689 | | |
691 | | - | |
692 | | - | |
| 690 | + | |
| 691 | + | |
693 | 692 | | |
694 | 693 | | |
695 | | - | |
| 694 | + | |
696 | 695 | | |
697 | 696 | | |
698 | 697 | | |
| |||
705 | 704 | | |
706 | 705 | | |
707 | 706 | | |
708 | | - | |
| 707 | + | |
709 | 708 | | |
710 | 709 | | |
711 | | - | |
| 710 | + | |
712 | 711 | | |
713 | 712 | | |
714 | 713 | | |
| |||
762 | 761 | | |
763 | 762 | | |
764 | 763 | | |
765 | | - | |
766 | | - | |
| 764 | + | |
767 | 765 | | |
768 | 766 | | |
769 | | - | |
770 | | - | |
| 767 | + | |
771 | 768 | | |
772 | 769 | | |
773 | 770 | | |
| |||
1333 | 1330 | | |
1334 | 1331 | | |
1335 | 1332 | | |
1336 | | - | |
1337 | | - | |
1338 | | - | |
| 1333 | + | |
1339 | 1334 | | |
| 1335 | + | |
| 1336 | + | |
1340 | 1337 | | |
1341 | 1338 | | |
1342 | 1339 | | |
| |||
1745 | 1742 | | |
1746 | 1743 | | |
1747 | 1744 | | |
1748 | | - | |
1749 | | - | |
1750 | | - | |
| 1745 | + | |
| 1746 | + | |
1751 | 1747 | | |
1752 | 1748 | | |
1753 | 1749 | | |
| |||
1822 | 1818 | | |
1823 | 1819 | | |
1824 | 1820 | | |
1825 | | - | |
1826 | | - | |
1827 | | - | |
| 1821 | + | |
1828 | 1822 | | |
1829 | 1823 | | |
1830 | 1824 | | |
| |||
1837 | 1831 | | |
1838 | 1832 | | |
1839 | 1833 | | |
1840 | | - | |
| 1834 | + | |
1841 | 1835 | | |
1842 | 1836 | | |
1843 | 1837 | | |
| |||
Lines changed: 37 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
562 | 567 | | |
563 | 568 | | |
564 | 569 | | |
| |||
603 | 608 | | |
604 | 609 | | |
605 | 610 | | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
606 | 633 | | |
607 | 634 | | |
608 | 635 | | |
| |||
616 | 643 | | |
617 | 644 | | |
618 | 645 | | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
626 | | - | |
| 646 | + | |
| 647 | + | |
627 | 648 | | |
628 | 649 | | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | 650 | | |
634 | | - | |
635 | | - | |
636 | | - | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
637 | 659 | | |
638 | 660 | | |
639 | 661 | | |
| |||
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
330 | 335 | | |
331 | 336 | | |
332 | 337 | | |
| |||
338 | 343 | | |
339 | 344 | | |
340 | 345 | | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
| |||
0 commit comments