Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Cache dependency on database select statement

Reply
Thread Tools

Cache dependency on database select statement

 
 
martin
Guest
Posts: n/a
 
      10-18-2003
Hi,

I have a page that contain a dropdown list of values.
This drop down list rarely changes so I wish to cache the page. However the
values in the dropdown box are taken from a database, so if the values in
the database change I wish to expire the cache and go to the database again
and get a fresh copy.

I have worked out that I should use one of the methods of cache.insert that
take a cache dependency object, for example

public void Insert(
string key,
object value,
CacheDependency dependencies,
DateTime absoluteExpiration,
TimeSpan slidingExpiration
);

However I am not sure how to create the cachedependency object from an
sqlstatement, and conect it to my database. my db is sql server 2000, the
select satement is of the form "select catID,CatName from category" and only
references a single table.

I have been able to create a cachedependency object that relies on an XML
file

dim objCache as new cachedependency(server.mapath(/myXMLfile))

however I am stumped creating a dependency on a database, is this possible,
Iwould be gratefull for any advice on how to do this.

cheers

martin.


 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      10-18-2003
It is possible, but not easy or graceful.
Here's the details:
http://msdn.microsoft.com/msdnmag/is...e/default.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com



"martin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I have a page that contain a dropdown list of values.
> This drop down list rarely changes so I wish to cache the page. However

the
> values in the dropdown box are taken from a database, so if the values in
> the database change I wish to expire the cache and go to the database

again
> and get a fresh copy.
>
> I have worked out that I should use one of the methods of cache.insert

that
> take a cache dependency object, for example
>
> public void Insert(
> string key,
> object value,
> CacheDependency dependencies,
> DateTime absoluteExpiration,
> TimeSpan slidingExpiration
> );
>
> However I am not sure how to create the cachedependency object from an
> sqlstatement, and conect it to my database. my db is sql server 2000, the
> select satement is of the form "select catID,CatName from category" and

only
> references a single table.
>
> I have been able to create a cachedependency object that relies on an XML
> file
>
> dim objCache as new cachedependency(server.mapath(/myXMLfile))
>
> however I am stumped creating a dependency on a database, is this

possible,
> Iwould be gratefull for any advice on how to do this.
>
> cheers
>
> martin.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
Cache dependency for SQL database changed Steffen Loringer ASP .Net 2 05-17-2005 03:38 PM
Cache Dependency Question Jason Dean ASP .Net 2 12-17-2004 06:00 AM
cache dependency object wh ASP .Net 2 04-06-2004 04:18 AM



Advertisments