Code for the file dependency in cache, DOT NET Programming

Show the code for the file dependency in cache?

Partial Class

Default_aspx

Public Sub displayAnnouncement() Dim announcement As String

If Cache("announcement") Is Nothing Then

Dim file As New _ System.IO.StreamReader _

(Server.MapPath("announcement.txt")) announcement = file.ReadToEnd file.Close()

Dim depends As New _ System.Web.Caching.CacheDependency _

(Server.MapPath("announcement.txt")) Cache.Insert("announcement", announcement, depends)

End If

Response.Write(CType(Cache("announcement"), String)) End Sub

Private Sub Page_Init(ByVal sender As Object, ByVal e As

System.EventArgs) Handles Me.Init displayAnnouncement()

The Above given process display Announcement () displays banner text from the Announcement.txt file that is lying in  the application path of the web directory. The Above method first checks whether the Cache object is nothing, if the cache object is nothing then it moves further to load the cache data from the file. When the file data changes the cache object is removed and set to nothing.

Posted Date: 9/22/2012 2:13:20 AM | Location : United States







Related Discussions:- Code for the file dependency in cache, Assignment Help, Ask Question on Code for the file dependency in cache, Get Answer, Expert's Help, Code for the file dependency in cache Discussions

Write discussion on Code for the file dependency in cache
Your posts are moderated
Related Questions
We need a .NET Synchronisation of BugNet -> Paymo -> Insightly We need a small .net utility that is able to synchronise projects as well as tasks between three applications 1

Develop Skype Recorder Application + Setup + Sourcecode + NICE UI Project Description: i need an application built which will allow user to record skype audio or video calls

How do I write common code for different dot net framework data providers?

What are the different locks in SQL SERVER? Depending on the transaction level there are six types of lock that can be acquired on data :- 1)Intent: The intent lock des

A Super-hero Sharepoint developer with great design skills Project Description: US: Our start-up company develops a very cool and innovative SharePoint related product with c

Project Description: Looking for a developer who will develop a web portal like zulutrade, some features will be taken from signaltrader the changes ould be like: 1) only cer

Describe the role that XSL can play while dynamically generating HTML pages from a relational database. The SQLXML 3.0 and advanced versions give the facility of mapping the SQ

Create page website to catalog some of the music: A homepage:  that automatically comes up when you go to 127.0.0.1:3000 (instead of the default Ruby-on-Rails pa

Web application and XML data storage One person should create a library (Java package of classes) for managing the list of bibliography entries, and for saving and loading th

What is the difference between thread and process?  Thread - is used to implement more than one program at a time. process - implements single program A thread is a path