Zoque.Forum
Dirsek Teması:
Geri Dön Zoque.Forum » Webmaster Kaynaklari » Sunucu Tabanlı Programlama (Server Side) » ASP » Asp: Caching


Yanıt
 
LinkBack Seçenekler
Old 27.06.2006   #1 (permalink)
 
OrQun's Avatar
 
Üyelik Tarihi: 31.12.2002
Yer: İstanbul
Yaş: 21
Mesaj: 71
Asp: Caching


Selamlar herkese.. Sitemde üyelerimin bilgilerini veritabınında alırken recordset açmak çok büyük performans kaybı yaratıyor.. Bu yüzden üyelerin bilgilerini 6 saatte bir güncellencek ASP sayfası olarak kaydetmek istiyorum.. Yani hiç veritabanına bulaşmadan üyelerin bilgilerini alabilmek istiyorum.. sanırım buna sqlcaching deniliyor.. forumdaki diğer yazıyı da okudum ama yapamadım bir türlü.. Elinde basit bir örnek olan varsa incelemem için bana gönderebilir misiniz? Ya da önceden yapan varsa nasıl yapacağımı bana anlatabilir misiniz?.. Teşekkürler..
__________________
community'n'link - orqun.com
OrQun şu an çevrimdışı  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl'e kaydet! http://reddit.com/submit?url=%url%&title=%title%Wong'e kaydet!Yahoo'ya kaydet!Google'a kaydet!MSN'e kaydet!Facebook'e kaydet!
Mesajdan alıntı yaparak yeni bir cevap ekleyin
Old 27.06.2006   #2 (permalink)
 
stalker's Avatar
 
Üyelik Tarihi: 01.11.2000
Yer: İstanbul
Yaş: 27
Mesaj: 713
Re: Asp: Caching

şöyle yapabilirsin. application nesnesine yaz istediğin recordset'i. Kolleksiyonda mevcut değilse ya da zamanı gelmişse refresh eder, baştan yüklersin.

Tabi application nesnesine obje yükleyemediğin için bir diziye falan dönüştürmen gerekecek herhalde.
__________________
life is better without braces
stalker şu an çevrimdışı  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl'e kaydet! http://reddit.com/submit?url=%url%&title=%title%Wong'e kaydet!Yahoo'ya kaydet!Google'a kaydet!MSN'e kaydet!Facebook'e kaydet!
Mesajdan alıntı yaparak yeni bir cevap ekleyin
Old 27.06.2006   #3 (permalink)
 
absconder's Avatar
 
Üyelik Tarihi: 09.12.2000
Yer: istanbul
Yaş: 30
Mesaj: 1,951
Re: Asp: Caching

SCOPE=Application olan bir(kaç) Custom Recordset tanımlayarak yapabilirsiniz. Application_OnStart'ta Recordset'i oluşturup bilgileri DB'den Recordset'e güncellersiniz, kayıtlarını bunun üzerinden takip edersiniz, Ekleme/Silme işlemini bu Recordset üzerinde yaparsınız, belirli aralıklarla bu Recordst'ten DB'yi güncellersiniz. Ancak herhangi bir nedenden Application nesnesini kaybederseniz güncel bilgilerinizi kaybetme riski ile karşı karşıyasınız, bu durumda Application_OnEnd'e güvenmek zorundasınız (IIS 6.0 dan sonra gayet güvenli aslında). Teorik olarak aslında bir veritabanına bile ihtiyacınız yok

http://forum.zoque.net/showpost.php?...35&postcount=5

unutmadan, bir application nesnesini XML olarak da kullanabilirsiniz. aynı mantığı bu durumda da işletmeniz gerekebilir.

bir de, ASP.net'te bu işi Cache kullanarak otomatize edebilirsiniz
__________________
"oturduğum mahallenin yolları çamurluydu, boyalı ayakkabı giysem bile, o yollardan geçtikten sonra çamurlanmamaları mümkün değildi. hayatım da böyle." yılmaz güney
http://www.sipidik.com

Mesaj absconder tarafından 27.06.2006 (14:24) yeniden düzenlendi..
absconder şu an çevrimdışı  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl'e kaydet! http://reddit.com/submit?url=%url%&title=%title%Wong'e kaydet!Yahoo'ya kaydet!Google'a kaydet!MSN'e kaydet!Facebook'e kaydet!
Mesajdan alıntı yaparak yeni bir cevap ekleyin
Old 28.06.2006   #4 (permalink)
 
Karakan's Avatar
 
Üyelik Tarihi: 26.05.2006
Yer: Ankara
Yaş: 24
Mesaj: 178
Görsel: 5
Re: Asp: Caching

Kod:
<%
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Author: Chris Davis
' Email: web.jockey@verizon.net
' Use: Feel free to use or modify this source code as you
'      like for your own applications.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Purpose of Functions
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This collection of functions are meant to easily store
' and retreive files from a common web server cache
' directory.  The main reason for this is to help speed up
' web pages where remote slow data sources such as
' Newsfeeds, Stock Quotes, weather, or other data are 
' rendered, then displayed.  This can help to minimize
' the number of actual requests made of the external data
' sources while speeding up performance for those who visit
' pages with cached information on them.
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Prerequisites
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Create folder within your wwwroot folder called 
' "CacheFiles".  Make sure that the IUSR web account has
' change priviledges to this folder so cache files can be
' created.
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Example
'   Be sure to include this file using the
'   <!-- #INCLUDE VIRTUAL="/Include/cache.ASP" -->
'   directive...  Example code below assumes this...
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   Dim CachedStockSymbols
'
'   ' To simplify our example, let's assume we have some 
'   ' generic function called GetStocks() which reads stock 
'   ' symbols from some external source and handles rendering
'   ' of data into HTML output.
'   ' It may take a while to read the stock symbols so you
'   ' are interested in improving performance.  Also, in case
'   ' your server loses connection with the external source,
'   ' want to pull from recent cache so that something is
'   ' displayed.  You decide that you only need to pull the
'   ' information once every 15 minutes.
'
'   ' First, see if we have a cached version of our HTML.
'   ' The ID name for this page is "Stocks", cache needs
'   ' to be newer than 15 minutes, and we do not want to
'   ' override the time and get what's cached...
'   CachedStockSymbols = GetFromCache ("Stocks", 15, False)
'
'   If CachedStockSymbols = "" Then
'     ' If there's nothing in cache that's valid, then 
'     ' get stocks...
'     CachedStockSymbols = GetStocks ("^DJI ^IXIC ^GSPC")
'     If CachedStockSymbols = "" Then
'       ' If the GetStocks function didn't return anything
'       ' then get what was last cached, regardless of age...
'       CachedStockSymbols = GetFromCache ("Stocks", 15, True)
'     Else
'       ' Now that we have new stock feed, save it to cache
'       ' for next user...
'       SaveToCache ("Stocks", CachedStockSymbols)
'     End If
'   End If
'   
'   ' Output CachedStockSymbols
'   Response.Write CachedStockSymbols
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Notes
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' These cache files are unique to each page.  The file name
' of each cache file is based on the PATH_INFO server 
' variable which is unique for each page.  Add to that the
' ID string so you can pull from multiple cache sources on
' a page and this becomes a very flexible utility.
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' CachePath - Creates a standard path location and file name
' to store the cache file.  The current ASP page is used with
' all path related characters stripped from the path and ID
' to automatically generate a unique ID.  As long as unique
' cache IDs exist on one page, then there will be no conflict.
'
' strID can be the same on multiple pages.  It is appended
' to the end of each cache file.  For example, if my page
' were /Content/Default.ASP and from within that ASP file
' I created a cache with the strID of "Stocks", the resulting
' file put into the CacheFiles folder would be named:
' -Content-Default-ASP-Stocks.cache
' If another page located in /Content/MyFolder/Stocks.ASP
' used "Stocks" as the strID, the resulting name would be:
' -Content-MyFolder-Stocks-ASP-Stocks.cache


Function CachePath (strID)
	' The following lines make sure that no illegal characters
	' exist in the cache filename.
	CachePath = Request.ServerVariables("PATH_INFO") & "-" & strID
	CachePath = Replace(CachePath, ":", "-")
	CachePath = Replace(CachePath, "\", "-")
	CachePath = Replace(CachePath, "/", "-")
	CachePath = Replace(CachePath, ".", "-")

	' If you decide to move the location of your CacheFiles folder,
	' just make the change here:
	CachePath = server.Mappath("\CacheFiles") & "\" & CachePath & ".cache"
End Function



'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' SaveToCache - Saves a given string input to a cache file.
'
' strID - Cache ID to save as
'
' strInput - Content to be cached to disk

Sub SaveToCache (strID, strInput)
	Dim LocalFileLoc, f, oFSO
	' Calculate Cache File Location
	LocalFileLoc = CachePath (strID)
	
	Set oFSO = CreateObject("Scripting.FileSystemObject")

	' Delete old file
	If (oFSO.FileExists(LocalFileLoc)) Then
		oFSO.DeleteFile(LocalFileLoc)
	End If

	' Create new one
	Set f = oFSO.OpenTextFile(LocalFileLoc, 2, True)
	f.Write strInput
	f.Close
	Set f = Nothing
	Set oFSO = Nothing
End Sub



'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' GetFromCache - Reads a file from the local disk and returns
' the contents of the file if the cache is current.  If cache
' is not current, then an empty string is returned.
'
' strID - ID of Cache file.  This is used when caching more
' one item on a page.  Give it a ID string that's unique on
' the page.
'
' intMinutes - Maximum age in minutes the cache file can be
' used from original time of creation.
'
' bUseExisting - (True/False) - When this is set to true, 
' the cache file will be read regardless of its age, if
' available.  If False, then the cache file is read in
' only if it is newer than intMinutes (see above).  If the
' cache file is older or doesn't exist, then a null string
' is returned.

Function GetFromCache (strID, intMinutes, bUseExisiting)
	Dim oFSO, oFile, PermissionChecker, FileInput
	Dim LocalFileLoc, LastModified

	' Set default value
	GetFromCache = ""

	' Get the Cache File Location
	LocalFileLoc = CachePath (strID)

	' Check to see if file exists
	Set oFSO = server.CreateObject("Scripting.FileSystemObject")
	If (oFSO.FileExists(LocalFileLoc)) Then
		'Check to see if current user can access the file
		Set PermissionChecker = server.CreateObject("MSWC.PermissionChecker")
		If PermissionChecker.HasAccess(LocalFileLoc) Then
			'Get file date for time comparison
			Set oFile = oFSO.GetFile(LocalFileLoc)
			LastModified = oFile.DateLastModified
			'If file is new enough or bUseExisiting is True, then read file.
			If (DateDiff ("n", LastModified, Now()) < intMinutes) or (bUseExisiting = True) Then
				Set FileInput = oFSO.OpenTextFile(LocalFileLoc, 1)
				do while not FileInput.AtEndOfStream
					GetFromCache = GetFromCache & FileInput.ReadLine & vbCRLF
				loop
				FileInput.Close
				Set FileInput = Nothing
			End If
			Set oFile = Nothing
		End If
		Set PermissionChecker = Nothing
	End If
	Set oFSO = Nothing
End Function
%>
XML/RSS feedlerde özellikle işe yarıyor.
__________________
Makale || Matematik yalan söylemez. || ArtDusunce || differentiate yourself from others.
Karakan şu an çevrimdışı  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl'e kaydet! http://reddit.com/submit?url=%url%&title=%title%Wong'e kaydet!Yahoo'ya kaydet!Google'a kaydet!MSN'e kaydet!Facebook'e kaydet!
Mesajdan alıntı yaparak yeni bir cevap ekleyin
Old 29.06.2006   #5 (permalink)
 
absconder's Avatar
 
Üyelik Tarihi: 09.12.2000
Yer: istanbul
Yaş: 30
Mesaj: 1,951
Re: Asp: Caching

Alıntı:
LetSDie tarafından gönderilen mesaj:
XML/RSS feedlerde özellikle işe yarıyor.
bu soruna çözüm getirmeyecektir, zira aynı işlem SQL server ile de yapılır. Dosya Okuma/Tablo okuma arasında performans testi ile aradaki fark görülebilir
__________________
"oturduğum mahallenin yolları çamurluydu, boyalı ayakkabı giysem bile, o yollardan geçtikten sonra çamurlanmamaları mümkün değildi. hayatım da böyle." yılmaz güney
http://www.sipidik.com
absconder şu an çevrimdışı  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl'e kaydet! http://reddit.com/submit?url=%url%&title=%title%Wong'e kaydet!Yahoo'ya kaydet!Google'a kaydet!MSN'e kaydet!Facebook'e kaydet!
Mesajdan alıntı yaparak yeni bir cevap ekleyin
Old 29.06.2006   #6 (permalink)
 
Karakan's Avatar
 
Üyelik Tarihi: 26.05.2006
Yer: Ankara
Yaş: 24
Mesaj: 178
Görsel: 5
Re: Asp: Caching

Aplication kullanmaya da ben taraftar degilim acıkcası,cok fazla güvenlik acıgı verebiliyor..yinede bir sorun için bir kaç alternatif çözüm iyidir
__________________
Makale || Matematik yalan söylemez. || ArtDusunce || differentiate yourself from others.
Karakan şu an çevrimdışı  
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl'e kaydet! http://reddit.com/submit?url=%url%&title=%title%Wong'e kaydet!Yahoo'ya kaydet!Google'a kaydet!MSN'e kaydet!Facebook'e kaydet!
Mesajdan alıntı yaparak yeni bir cevap ekleyin
Sponsorlu Bağlantılar
Zoque.Forum
Reklam
Yanıt

Etiketler

caching , asp



 
Zoque'a hoşgeldiniz!
Zoque 27.02.1999 tarihinde yayın hayatına başlamış, paylaşıma dayalı bir oluşumdur. Tasarım, teknoloji, web, kültür ve sanat ana başlıkları altında bilgi paylaşımı ve benzer değerlere sahip katılımcıların birbirleriyle iletişime girmelerine imkan sağlar. "Az ama Öz" sloganından yola çıkarak, kaliteli ve nitelikli katılımı temel alır.

Saygın ve ciddi bir ortamda yardımlaşmak, haberleşmek, kendi bildiklerini diğer katılımcılarla paylaşmak isteyen, oluşumumuza düzenli katılımda bulunacağı inancını taşıyan konuklarımızı üye olmaya davet ediyoruz. [ » ]


Üye Girişi:

UslanmaM baktabul.com TEKplatform TEKplatform

En popüler ilk 100 etiket
Tag Cloud
acil adsl ajax almak arama araniyor ariyorum ariyoruz asp bilen bilgi bilgisayar blog calisma canon css dijital div domain dosya eleman film firefox flash font form forum fotograf freelance google gore grafik grafiker hakkinda hangi hata hatasi hosting html ilgili ilk image internet istanbul istiyorum java javascript karakter kayit kisisel kullanimi link logo mac mail menu muzik mysql nasil neden nedir online photoshop php problemi program programi reklam resim satilik sayfa script server ses sistemi site sitesi son soru sorun sorunsali sorunu sql swf tasarim tasarimci tasarimcisi tasarimi turk turkce veri video web windows wordpress xml yardim yazi yeni zoque
Zoque RSS Aboneliği
Son eklenen konuları e-posta ile haber verelim mi?

Forum Yazılımı: vBulletin® Version 3.7.3 Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

Arayüz/Skin "Güneş" © www.zoque.com / net. Copyright © 1999 - 2008
Forum Saati GMT +2. Şu anda saat: 15:35.