-
Notifications
You must be signed in to change notification settings - Fork 0
Use Caffeine for request aggregation #6
Use Caffeine for request aggregation #6
Conversation
Guava's cache is not thread-safe, see GuavaCacheTest to verify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work so far. Just some small suggestions
src/main/java/org/cryptomator/cloudaccess/requestdecorator/CloudProviderDecorator.java
Outdated
Show resolved
Hide resolved
...java/org/cryptomator/cloudaccess/requestdecorator/MetadataRequestDeduplicationDecorator.java
Show resolved
Hide resolved
src/main/java/org/cryptomator/cloudaccess/requestdecorator/QuotaRequestCachingDecorator.java
Show resolved
Hide resolved
I think you mean that Unfortunately we cannot natively do that for |
src/main/java/org/cryptomator/cloudaccess/requestdecorator/QuotaRequestCachingDecorator.java
Show resolved
Hide resolved
As suggested in the code review of #6
As we found out and demonstrated using GuavaCacheTest.java that the Guava-Cache isn't completely thread-safe, we're switching to
Caffeine
for metadata request deduplication:The new
MetadataRequestDeduplicationDecorator
decorates an existingCloudProvider
by de-duplicating identical itemMetadata and list-requests so that the delegate is called only once until the future is completed.Furthermore, quota-requests are cached for a duration of default 10 seconds (can be set using
org.cryptomator.cloudaccess.metadatacachingprovider.timeoutSecond
).In projects that use this library, we will write a factory that selects the best metadata decorator, currently
MetadataCachingProviderDecorator
orMetadataRequestDeduplicationDecorator
.