What is the difference between caching and writing?

I would like to know what is the real difference between caching and memoization .
In my opinion, both include avoiding repeated function calls to retrieve data by storing it .

What is the main difference between the two?

+100
terminology caching memoization
Jun 24 2018-11-11T00:
source share
5 answers

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 this is related to caching, memoization refers to the specific case of this optimization, distinguishing it from forms of caching such as buffering or page replacement.

+95
Jun 24 2018-11-11T00:
source share

As I have seen, they are used, “memoization” is “caching the result of a deterministic function”, which can be reproduced at any time with the same function and inputs.

"Caching" includes basically any output-buffering strategy, regardless of whether the original value is being played at a given point in time. In fact, caching is also used to indicate input buffering strategies, such as caching to disk or memory. So this is a much more general term.

+44
Jun 24 '11 at 15:02
source share

I think that term caching is usually used when you save the results of I / O operations or basically any data coming to you from outside (files, network, db requests). Thermal memoization is usually used to store the results of your own calculations, for example, in the context of dynamic programming.

+6
Jun 24 2018-11-11T00:
source share

Memoization is a special form of caching the result of a deterministic function. This means that caching the result outside the function is not memoization, because the function will have to mutate the cache when computing a new result (not yet in the cache), so it will no longer be a (pure) function. Remembering usually involves passing the cache as an additional argument (in an auxiliary function). Memoization will optimize functions that need to calculate values ​​several times for a single access. Caching will optimize functions that are called multiple times with the same parameters. In other words, Memoization optimizes first access, whether caching will optimize re-access.

+1
Sep 03 '14 at 7:46
source share

I would like to add to the other excellent answers that the memo is also known as tabs. I think it’s also important to know this term for those who study what memorization and caching are.

0
Jan 02 '19 at 21:00
source share



All Articles