How does one use cached data in a functional language such as Erlang?

后端 未结 3 689
眼角桃花
眼角桃花 2020-12-30 04:08

I\'ve been reading a bit lately about functional languages. Coming from 10+ years of OO development, I\'m finding it difficult to get my head around how on earth one can poi

3条回答
  •  猫巷女王i
    2020-12-30 04:37

    There is no reason a Cache and a Functional language can't live together. To be functional you just have to obey the constraint that calling the same function with the same arguments you get the same answer.

    For instance: get_data(Query, CacheCriteria)

    Just because the get_data uses a cache doesn't mean it's not functional. As long as calling get_data with the same Query, and CacheCriteria arguments always returns the same value then the language can be considered functional.

提交回复
热议问题