What is the difference between Caching and Memoization?

后端 未结 5 751
南方客
南方客 2021-01-30 15:17

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

5条回答
  •  花落未央
    2021-01-30 16:11

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

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

    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.

提交回复
热议问题