macmemo icon indicating copy to clipboard operation
macmemo copied to clipboard

The annotation only accept const value

Open oldbig opened this issue 3 years ago • 0 comments

The following code not works:

import com.softwaremill.macmemo.memoize

class GraphBuilder {
  val max = 20000
  // val max = read from props file.
  @memoize(maxSize = max, expiresAfter = 2 hours)
  def creatGraph(elementCount: Int): Graph = {
    someExpensiveCode()
  }

}

what about making the parameters are call by name? just like this:

class memoize(maxSize: => Long, expiresAfter: => FiniteDuration, concurrencyLevel: => Option[Int] = None)

oldbig avatar Aug 15 '21 14:08 oldbig