Andrey Blazhey
Andrey Blazhey

Reputation: 13

Using cache for Rails

Good afternoon. I need your help, please tell me whether it is possible when retrieving data from third-party services to sort them and keep an array sorted in the cache. If so, how do interactions with cache

Upvotes: 0

Views: 61

Answers (1)

nickcen
nickcen

Reputation: 1692

take a look at the CacheStore section of this page http://guides.rubyonrails.org/caching_with_rails.html#cache-stores. It doesn't matter where you retrieve the data, just assign a cache key to the data you wanna to cache, and before each fetching, do a check to see whether that key is exists, if it doesn't do the actual fetching, otherwise get it back from the cache.

Upvotes: 1

Related Questions