我想知道缓存
和内存
之间的实际区别是什么。
在我看来,两者都涉及通过存储数据来避免重复的函数调用来获取数据。
两者的核心区别是什么?
最佳答案
记忆化是一种特定形式的缓存,涉及根据函数的参数缓存函数的返回值。
缓存是一个更通用的术语;例如,HTTP 缓存是缓存,但不是内存。
维基百科 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.
关于caching - 缓存和记忆化有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6469437/