您现在的位置是:首页 > 文章详情

Hunt Cache 0.6.0 发布,D 语言分布式缓存框架

日期:2019-11-26点击:567

Hunt Cache 是一个支持二级缓存的 D 语言缓存框架,现在支持的缓存后端有 Redis、Memcache、Memory、RocksDB。

新的改进:

  1. 基于高性能的 Radix 算法作为 Memory 驱动的实现
  2. 使用全新的 Hunt Redis 作为 Redis 缓存后端
  3. 支持 Redis Cluster 集群缓存
  4. 在 Redis 驱动可以指定 DB
  5. 修复问题..

示例代码:

import hunt.cache;
import hunt.logging;

struct User
{
    int id;
    string name;
    int age;
}

void main()
{
    auto cache = CacheFactory.create();

    // 定义缓存主键
    string key = "userinfo";

    User user;
    user.id = 1;
    user.name = "zoujiaqing";
    user.age = 100;

    // 设置缓存
    cache.set(key, user, 10);

    // 获取缓存的值绑定指定类型对象
    User u = cache.get!User(key);

    logDebug(u.name);
}

 

原文链接:https://www.oschina.net/news/111621/hunt-cache-0-6-0-released
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章