jsr107 / jsr107spec

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

Size based eviction policy #422

Open pizzi80 opened 10 months ago

pizzi80 commented 10 months 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) ))