Scalacache pass cache instance

2019-09-17 15:26发布

问题:

To initialise Scalacache instance in my service

import scala cache._    
implicit val scalaCache = ScalaCache(new MyCache())

but i am not getting what is new MyCache() so i have to pass a cache instance to construct a Scala Cache.

how to initialise mycache()

how to create a ScalaCache instance

reference : https://index.scala-lang.org/cb372/scalacache

回答1:

MyCache is some implementation of Cache trait. There is one for each of following:

The following cache implementations are supported, and it's easy to plugin your own implementation:

Google Guava

Memcached

Ehcache

Redis

Caffeine

Specific examples for each are given under https://github.com/cb372/scalacache#cache-implementations.



标签: scala caching