def setup()

in storehaus-benchmark/src/main/scala/com/twitter/storehaus/benchmark/WriteThroughCacheBenchmark.scala [57:86]


    def setup(): Unit = {
      val rng = new scala.util.Random(3)
      val byteEncoder = implicitly[Injection[Long, Array[Byte]]]

      def size: Int = rng.nextInt(10) + 1 // 1 -> 10

      def hll(elements: Set[Long]): HLL =
        hllMonoid.sum(elements.map(byteEncoder(_)).map(hllMonoid.create))

      val inputIntermediate = (0L until numElements).map { _ =>
          val setElements = (0 until size).map{_ => rng.nextInt(1000).toLong}.toSet
          (pow(numInputKeys, rng.nextFloat).toLong, hll(setElements))
        }.grouped(20)

      inputData = inputIntermediate.map(s => MapAlgebra.sumByKey(s)).toSeq

      val delayedStore = new DelayedStore(new ConcurrentHashMapStore[Long, HLL])

      val hhStore = HHFilteredStore.buildStore[Long, HLL](
          new ConcurrentHashMapStore[Long, HLL],
          MutableCache.ttl(Duration.fromSeconds(10000), numElements),
          HeavyHittersPercent(0.5f),
          WriteOperationUpdateFrequency(1),
          RollOverFrequencyMS(10000000L)
        )

      store = new WriteThroughStore(delayedStore, hhStore).toMergeable

      noCacheStore = delayedStore.toMergeable
    }