Consider a Scala macro-based annotation such as @memoise from macmemo. The annotation requires two arguments: a max cache size and a time-to-live, e.g.,
@memoize(maxSize = 20000, expiresAfter = 2 hours)
Say you want to create a @cacheall
annotation that is equivalent to @memoize(maxSize = Int.MaxValue, expiresAfter = 100 days)
in order to reduce boilerplate and have a single point of parameterization.
Is there a standard pattern for this type of reuse? Obviously,
class cacheall extends memoize(Int.MaxValue, 100 days)
won't work because of the compile-time argument parsing in the macro.