steveklabnik / request_store

Per-request global storage for Rack.
https://github.com/steveklabnik/request_store
MIT License
1.47k stars 87 forks source link

Question: How this differs from ruby memoization? #56

Closed imechemi closed 7 years ago

imechemi commented 7 years ago

hi, I was looking to save expensive service calls in my project and found that there are various ways to do that. But I have a problem with differentiating request_store from memoization. After reading about these on forums and blogs, I found that both spans for a one request/response cycle.

Can someone help me with understanding the main difference between the two?

Sorry for misusing the issue. I would really be grateful if someone can guide me. thank you :)

steveklabnik commented 7 years ago

"Memoization" is a general software programming technique. This gem provides "request local" storage. They're not really comparable, exactly. Something like thread-local storage is one way to implement memoization, but that's an implementation detail.