Store pictures as files or in the database for a web app?

后端 未结 10 1810
孤城傲影
孤城傲影 2020-11-22 06:32

My question is fairly generic and I know there might not be an 100% answer to it. I\'m building an ASP .NET web solution that will include a lot of pictures and hopefully a

10条回答
  •  盖世英雄少女心
    2020-11-22 07:04

    Just to add some more to the already good answers so far. You can still get the benefits of caching from both the web level maybe and the database level if you go the route keeping you images in the database.

    I think for the database you can achieve this by how you store the images with relation to the textual data associated with them and if you can the access to the images into a particular query so that the database can cache the query (just theory though so feel free to nuke me on that part).

    With the web side, I would guess since you're question is tagged up with asp.net that you would go the route of using a http handler to serve up the images. Then you have all the benefits of the framework at your disposal and you can keep you domain logic cleaner with only having to pass the key to your image to the http handler.

提交回复
热议问题