views:

18

answers:

1

hi, i want to know which approach is better to saving Webpage content to database for caching?

  1. Using ntext data-type and save content as flat string
  2. Using ntext, but compress content and then save
  3. Using varbinary(MAX) to save content (how i can convert flat string to binary? ;-))
  4. An other approach which you are suggest to me

UPDATE

in more depth i have many table (URLs, Caches, ParsedContents, Words, Hits and etc) which for each url in URLs table i'm sending request and save response into caches table. this is Downloader (URLResolver of Google) section of my engine. then indexer section act was to perform parsing and etc tasks which associated with this. and Compress/Decompress performs only when new content goes to be caching or parsing

+1  A: 

The better approach would be to use the built-in caching features in ASP.NET. Searching StackOverflow for [asp.net] [caching] is a good start, and after (or before) that, similar searches on both www.asp.net and Google will get you quite far.


In response to your comment, I would probably save the data as a flat string. It might not be the best option performance-wise when it comes to storage, but if you're going to perform searches on the text content, you don't want to have to compress/decompress or convert to/from binary every time, since there is probably no (easy) way to do this inside SQL Server. Just make sure you have all intexes and full-text features you need set up correctly.

Tomas Lycken
The main reason I can't give a more detailed answer is that you haven't specified if you're working in ASP.NET WebForms, WebPages or MVC Framework.
Tomas Lycken
oh man, i want to cache content to parsing up content's later and performing search on parsed contents. i'm developing very basic web search engine ;)
Sadegh
@Sadegh: Ah! In that case, see my update.
Tomas Lycken
ok, but compress/decompress section performs only when webpage re-cached every week(for example) and actually searching is performed on the parsed-contents which parsed-contents generated by parsing cached-contents.
Sadegh