Code for the file dependency in cache, DOT NET Programming

Show the code for the file dependency in cache?

Partial Class


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
What is Reference counting in COM? The Reference counting is a memory management method used to count the number of times an object has a pointer referring to it. The very firs

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

Looking to build FIFA coins selling and buying website Project Description: I would like a website made for FIFA 14 TEAM. What this website will do is having automatically bu

ASP.NET 2.0 application port to ASP.NET MVC Project Description: Legacy ASP.NET application for managing tasks for a private client needs a complete re-write. The applicat

What are the core functionalities in XML .NET framework? The XML API for the .NET Framework includes the following set of functionalities: XML readers With XML readers

Explain project life cycle. Figure: -Life cycle of a project There are 5 stages of any project initiating, planning, executing, controlling, & closeout. These are the

What is cyclomatic complexity and why is it important? Cyclomatic complexity is a computer science metric (measurement) developed by Thomas McCabe used to generally calculate t

Finding Average of Array Elements - C# Program I need assignment help for Finding Average of Array Elements in C#. Can anybody send me there ideas?

Write a program of console statements - C# Program I am unable to make out the use of console statements in C# language. Can anyone suggest me any example for this.

What is Object Oriented Programming? This is a problem solving process to develop software systems. This is a technique to think real world in terms of objects. The Object maps