#how do I cache data from db

10 messages · Page 1 of 1 (latest)

wind garden
#

as above

polar vergeBOT
#

This post has been reserved for your question.

Hey @wind garden! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

fading flint
#

Caching is a huge topic

#

it would help if you could narrow down what you want more

#

do you want to cache

  • In memory, forever (ConcurrentHashMap might be a good use)
  • In memory, with custom expiration logic (the caffiene library would be good)
  • Out of memory, shared between nodes (hello redis)
  • In memory, but implicitly because you are doing ORM nonsense
  • ...
rigid flame
#

Also, unless it's absolutely performance critical, DON'T

fading flint
#

in a sense, all data fetching is caching

#

since by the time you ask your database a question and get the answer, the answer to the question might have changed

#

and there isn't much you can do about that sometimes