asp.net - What's the best way to cache complicated search queries in a .NET webapp? -
asp.net - What's the best way to cache complicated search queries in a .NET webapp? -
i have website allows users query specific recipes using various search criteria. example, can "show me recipes can create in under 30 minutes utilize chicken, garlic , pasta not olive oil."
this query sent web server on json, , deserialized searchquery
object (which has various properties, arrays, etc).
the actual database query expensive, , there's lot of default search templates used quite frequently. reason, i'd start caching mutual queries. i've done little investigation various caching technologies , read plenty of other posts on subject, i'm still looking advice on way go. right now, i'm considering next options:
built insystem.web.caching
: provide lot of command on how many items in cache, when expire, , priority. however, cached objects keyed string, rather hashable object. not need able convert searchquery
object string, hash have perfect , not produce collisions. develop own inmemory cache: i'd dictionary<searchquery, results>
object persists in memory across sessions. since search results can start large, i'd want able cap how many queries cached , provide way older queries expire. fifo queue work here. i'm worried things thread safety, , wondering if writing own cache worth effort here. i've looked other 3rd party cache providers such ncache , velocity. these both distributed cache providers , overkill need @ moment. plus, seems every cache scheme i've seen still requires objects keyed string. ideally, want holds cache in process, allows me key object's hash value, , allows me command expiration times , priorities.
i'd appreciate advice or references free , preferably open source solutions help me out here. thanks!
based on saying, recommend utilize system.web.caching
, build dataaccess
layer shielding rest of system. when called can create real time query or pull cached object based on business/application needs. today, memcached.
asp.net .net performance caching
Comments
Post a Comment