Skip to content

Commit

Permalink
Fix wrong cache capacity unit in NessiePersistCache (#7746)
Browse files Browse the repository at this point in the history
Leftover from #7643.
  • Loading branch information
adutra authored Nov 21, 2023
1 parent ab6a6ad commit f8d41bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ final class ClassPersistInstances {
NessiePersistCache nessiePersistCache =
PersistExtension.annotationInstance(context, NessiePersistCache.class);
cacheBackend =
nessiePersistCache != null
? PersistCaches.newBackend(nessiePersistCache.capacity(), null)
nessiePersistCache != null && nessiePersistCache.capacityMb() >= 0
? PersistCaches.newBackend(nessiePersistCache.capacityMb(), null)
: null;

backendTestFactory = reusableTestBackend.backendTestFactory(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@

/**
* Adds a cache in front of the created {@link
* org.projectnessie.versioned.storage.common.persist.Persist} instances, if the {@link #capacity()}
* is {@code >= 0}.
* org.projectnessie.versioned.storage.common.persist.Persist} instances, if the {@link
* #capacityMb()} is {@code >= 0}.
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface NessiePersistCache {
long capacity() default 1024 * 1024;

/** The maximum capacity of the cache in MB. Default is 1 MB. */
long capacityMb() default 1;
}

0 comments on commit f8d41bc

Please sign in to comment.