dongqishun6409 2019-02-17 21:34
浏览 35
已采纳

内存中的数据以最大程度地减少数据库读取?

How would you structure a program in Golang to ensure that a piece of data remains in volatile memory and is never cached to disk or swap?

I am trying to implement bloom filter for usernames to minimise disk reads.

With reference to Ensuring Secure Data Remains in Memory, I am looking for a solution in golang for a different purpose.

  • 写回答

1条回答 默认 最新

  • dongzan9069 2019-02-17 23:09
    关注

    You can invoke the mlock syscall (and its kin) in Go, using the syscall package. See https://golang.org/pkg/syscall/#Mlock, for example.

    That said, with the Go garbage collector that may not be 100% bullet-proof if you need cryptographic safety (e.g. ensure that keys never get to disk). You may want to consider libraries like memguard in that case.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?
  • ¥15 python爬取bilibili校园招聘网站
  • ¥30 求解达问题(有红包)
  • ¥15 请解包一个pak文件
  • ¥15 不同系统编译兼容问题
  • ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?