jsr107 / jsr107spec

JSR107 Cache Specification
Apache License 2.0
415 stars 164 forks source link

Size based eviction policy #422

Open pizzi80 opened 1 year ago

pizzi80 commented 1 year ago

How to define a Size based eviction policy?

I would expect something like:

new MutableConfiguration<>().setExpiryPolicyFactory(SizedExpiryPolicy.factoryOf( 12345 ))

or even better add the maxElements attribute, in this way it would be possible to cover the typical size and time cache policy

new MutableConfiguration<>()
.setMaxElements( 12345 )
.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf( new Duration(TimeUnit.DAYS,1) ))