Scala中的轻量级缓存解决方案?

编程入门 行业动态 更新时间:2024-10-26 18:15:30
本文介绍了Scala中的轻量级缓存解决方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我只是想知道Scala中是否有任何缓存解决方案. 我正在寻找类似于Guava在Java中提供的东西.

I just wonder if there is any caching solution available in Scala. I'm looking for something like it is provided by Guava in Java.

我也应该在Scala中使用番石榴吗? Scalaz中有包装纸或皮条客吗? 还有其他更适合Scala开发人员的选择吗?

Should I use Guava too in Scala? Is there a wrapper / pimp in Scalaz or something similar? Any alternative more appropriate for Scala devs?

番石榴提供的东西:

LoadingCache<Key, Graph> CACHE= CacheBuilder.newBuilder() .maximumSize(1000) .expireAfterWrite(10, TimeUnit.MINUTES) .removalListener(MY_LISTENER) .build( new CacheLoader<Key, Graph>() { public Graph load(Key key) throws AnyException { return createExpensiveGraph(key); } }); Supplier<Animal> singleAnimalCache = Suppliers.memoizeWithExpiration(animalFromDbSupplier(), 365, TimeUnit.DAYS);

我需要一些基本的缓存管理,例如Guava中的

I need some basic cache management like in Guava.

推荐答案

在Scalaz中有包装纸或皮条客吗?

Is there a wrapper / pimp in Scalaz or something similar?

在Scalaz 7中有一个Memo,我在学习Scalaz第16天中对此进行了介绍.

In Scalaz 7 there's Memo, which I covered a bit in learning Scalaz day 16.

这是亚当·罗西恩(Adam Rosien)在 scalaz对于我们其他人"中所涉及的第一件事说话,所以也检查一下.他正在使用Scalaz 6.

It's the first thing Adam Rosien covered in scalaz "For the Rest of Us" talk, so check that out too. He's using Scalaz 6.

更多推荐

Scala中的轻量级缓存解决方案?

本文发布于:2023-11-29 01:46:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1644799.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:缓存   解决方案   Scala

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!