If you intend your code to be scalable, then the best case is to use a database.
Static data into a web application in the memory of the process serving a request is not good practice. Unless you intend to implement a ObjectCache
who read and write in the comic book yourself, you will be limited to MemoryCache
which does exactly what I said earlier. (There is an implementation of ObjectCache
distributed call NCache
, read further below).
But then you could argue that the database is slow... but the truth is it’s not. Most applications read from the database, in all requests. In addition, it is possible to use multilevel cache strategies: using memory and database at the same time, when the need arises.
The point is... why not start with the safest? That works in all cases, and then the measure necessary to optimize the cache, migrate to a mixed approach, install a fiber optic cable between the web server and the BD server, migrate to Azure, Amazon, etc... are so many options to optimize this.
Distributed cache technologies
They are the best options as they are made to work even in distributed environments.
Take a look at [tour]. You can accept an answer if it solved your problem. You can vote on every post on the site as well. Did any help you more? You need something to be improved?
– Maniero