缓存和记忆化有什么区别? [英] What is the difference between Caching and Memoization?

查看:107
本文介绍了缓存和记忆化有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道缓存记忆化之间的实际区别是什么。

正如我所看到的,两者都涉及避免重复的函数调用以通过存储来获取数据

I would like to know what the actual difference between caching and memoization is.
As I see it, both involve avoiding repeated function calls to get data by storing it.

两者的核心区别是什么?

What's the core difference between the two?

推荐答案

记忆化是一种特殊的缓存形式,涉及根据功能的参数缓存功能的返回值 >。

Memoization is a specific form of caching that involves caching the return value of a function based on its parameters.

缓存是一个更笼统的术语;例如,HTTP缓存是缓存,而不是备忘录。

Caching is a more general term; for example, HTTP caching is caching but not memoization.

Wikipedia

Wikipedia says:


虽然与缓存有关,但是记忆是指此优化的特定情况,将其与缓存,例如缓冲或页面替换。

Although related to caching, memoization refers to a specific case of this optimization, distinguishing it from forms of caching such as buffering or page replacement.

这篇关于缓存和记忆化有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆