Should we cache raw objects or sorted objects?

We need a list of cities in alphabetical order for the client.

Should I cache the list since it is returned from the database (not sorted) OR cache it after sorting the list (how will it be returned to the client)?

+4
source share
2 answers

As already mentioned, it is best to sort in a database. What is aloof, if we assume that it is not sorted by the database, should it be sorted, then cache or cache it unsorted and sort it every time you retrieve it from the cache?

, . , , . .

, - API , . , . , , . , , .

. , , , 100 . , , " ". , , , 100 , . .

: , . , , . . .

+1

, . (. )

, . , . , / .

- not / . , .

, , . , , .

0

Source: https://habr.com/ru/post/1678163/


All Articles