Webmaster Forumu

Geri git   Webmaster Forumu > Webmaster Kaynak Eğitim Tanıtım Hizmet > İnternet Programlama ve Kodlama > PHP

PHP PHP & PHP Hızlandırıcılar

Cevapla
 
LinkBack Seçenekler Stil
  #1 (permalink)   iTrader 
Alt 2007-12-02, 22:02
maxcilopez - ait Kullanıcı Resmi (Avatar)
Member
 
Üyelik tarihi: Oct 2006
Mesajlar: 304
Tecrübe Puanı: 0
iTrader: %0/0
maxcilopez is an unknown quantity at this point
Standart klasörü aç, Toplam dosya sayısını bul ve cache

mrb arkadaşlar şöyle bir sorunum var. sitemde cache sistemi kullanıyorum
Kullandığım cache.php
PHP- Kodu:
<?
$cachesystem 
'yes'
$rootpath='./'
$cache 'cache'
$cachetime = (2*60) * 60// 2 saat
function cache_check ($file 'cachefile') { 
    global 
$cache,$rootpath,$cachesystem,$cacheident;
    if (
$cachesystem == 'yes') {
        
$cachefile $rootpath.$cache '/'.$file.'-'.$cacheident.'.html'
        
$cachetime 120 60// 2 Hours
        
$updatetime $cachetime 60 60;
        
define(TIMENOWtime());
        if (
file_exists($cachefile) && (TIMENOW $cachetime filemtime($cachefile))) 
        { 
            include_once(
$cachefile); 
            print(
"<p align=center><font class=small color=red><b>This content was last cached on ".date('Y-m-d H:i:s'filemtime($cachefile))." and updating every ".$updatetime." hours.</b></font></p>"); 
            exit; 
        } 
        
ob_start(); 
    }else 
        return; 

   
function 
cache_save  ($file 'cachefile') { 
    global 
$cache,$rootpath,$cachesystem,$cacheident
    if (
$cachesystem == 'yes') { 
        
$cachefile $rootpath.$cache '/'.$file.'-'.$cacheident.'.html'
        
$fp fopen($cachefile'w'); 
        
fwrite($fpob_get_contents());       
        
fclose($fp);         
        
ob_end_flush(); 
    }else 
        return; 

//-------------------------------------
//---- CACHE MOD Extension by DarkElder 
//-------------------------------------
$cacheident = ($_SERVER['QUERY_STRING'] != '' md5($_SERVER['QUERY_STRING']) : 'noGet');
//-------------------------------------
//---- CACHE MOD v0.4 by xam 
//-------------------------------------  
?>
Sorun = Sorunum ise şu cache klasörünü içerisine maksimum 1998 adet dosya kaydediliyor daha fazlası yazılamayor.

Yapmak istediğim
=dizinde cache2 klasörü oluşturcam. sonra bu cache.php ye öyle bir eklenti gelecekki. Önce cache klasörünü açacak sonra toplam dosya sayısını çıkaracak toplam dosya sayısı 1998 den küçükse cache klaösrüne dosyayı yaz. Ama 1998 e eşitse cache2 klasörüne yaz.

Şimdiden yazdımlarınız için tşk.
__________________
İstediğiniz Db İstediğiniz site Db sine Uyartılır.
Alıntı ile Cevapla

  #2 (permalink)   iTrader 
Alt 2007-12-03, 00:36
OnurSQL - ait Kullanıcı Resmi (Avatar)
Member
 
Üyelik tarihi: Mar 2005
Nerden: ankara
Mesajlar: 1.453
Tecrübe Puanı: 4
iTrader: %100/2
OnurSQL is on a distinguished road
Standart

FTP'de 1998 tane dosyayı görebiliyorsun, hepsini görmen için sunucu tabanlı değişiklik yapman lazım.
Alıntı ile Cevapla

  #3 (permalink)   iTrader 
Alt 2007-12-03, 00:57
Angelo - ait Kullanıcı Resmi (Avatar)
Platinum Member
 
Üyelik tarihi: Dec 2004
Nerden: Phoenix,AZ
Mesajlar: 4.347
Tecrübe Puanı: 8
iTrader: %100/4
Angelo is just really niceAngelo is just really niceAngelo is just really niceAngelo is just really nice
Standart

PHP- Kodu:
function cache_save  ($file 'cachefile') { 
    global 
$cache,$rootpath,$cachesystem,$cacheident
    if (
$cachesystem == 'yes') { 
       
       
// EKLENTI
       
$dir opendir($rootpath.$cache);
       
       while (
false !== ($files readdir($dir))) {
           if (
$files != "." AND $files != "..") {
           
$counter++;
           }
       }

        if (
$counter 1998) {
        
$cachefile $rootpath.'cache2/'.$file.'-'.$cacheident.'.html';
        }

        else {
        
$cachefile $rootpath.$cache '/'.$file.'-'.$cacheident.'.html';
        }

        
// /EKLENTI


        
$fp fopen($cachefile'w'); 
        
fwrite($fpob_get_contents());  
.... 
__________________
peace love union respect
Alıntı ile Cevapla

  #4 (permalink)   iTrader 
Alt 2007-12-03, 01:39
qooqle - ait Kullanıcı Resmi (Avatar)
Member
 
Üyelik tarihi: Aug 2006
Nerden: istanbul
Mesajlar: 357
Tecrübe Puanı: 2
iTrader: %0/0
qooqle is an unknown quantity at this point
Standart

angelo pm boşalt sana pm atcam
Alıntı ile Cevapla

  #5 (permalink)   iTrader 
Alt 2007-12-03, 18:11
maxcilopez - ait Kullanıcı Resmi (Avatar)
Member
 
Üyelik tarihi: Oct 2006
Mesajlar: 304
Tecrübe Puanı: 0
iTrader: %0/0
maxcilopez is an unknown quantity at this point
Standart

olmadı kardeş yazmıyor cache2 klaösrüne yazmıyor
__________________
İstediğiniz Db İstediğiniz site Db sine Uyartılır.
Alıntı ile Cevapla

  #6 (permalink)   iTrader 
Alt 2007-12-03, 21:00
Angelo - ait Kullanıcı Resmi (Avatar)
Platinum Member
 
Üyelik tarihi: Dec 2004
Nerden: Phoenix,AZ
Mesajlar: 4.347
Tecrübe Puanı: 8
iTrader: %100/4
Angelo is just really niceAngelo is just really niceAngelo is just really niceAngelo is just really nice
Standart

if ($counter > 1998) {

bunun üstüne

echo "dosya: $counter";

yazıp sonucu bildir.
__________________
peace love union respect
Alıntı ile Cevapla

  #7 (permalink)   iTrader 
Alt 2007-12-03, 21:13
iyinet - ait Kullanıcı Resmi (Avatar)
Paylaşım için teşekkürler
 
Üyelik tarihi: Sep 2002
Mesajlar: 6.470
Blog Entries: 2
Tecrübe Puanı: 3
iTrader: %100/6
iyinet is just really niceiyinet is just really niceiyinet is just really niceiyinet is just really niceiyinet is just really nice
Standart

Alıntı:
chmod 777 cache2
yapman gerekebilir
__________________
Forum Reklam Site Reklam
Alıntı ile Cevapla

  #8 (permalink)   iTrader 
Alt 2007-12-03, 21:17
iyinet - ait Kullanıcı Resmi (Avatar)
Paylaşım için teşekkürler
 
Üyelik tarihi: Sep 2002
Mesajlar: 6.470
Blog Entries: 2
Tecrübe Puanı: 3
iTrader: %100/6
iyinet is just really niceiyinet is just really niceiyinet is just really niceiyinet is just really niceiyinet is just really nice
Standart

Cache deki dosya sayısı arttıkça bu sorunları yaşamaya devam edeceksin.
Bu cache sistemi yerine sana şöyle bir önerim var.
cache dizini altına aşağıdaki dizinleri yarat
Alıntı:
0 1 2 3 4 5 6 7 8 9 a b c d e f
cache.php içinde dosya adlarını base64 encode edip ilk harfi ile eşleşen dizine at.
2 cache yerine 16 alt cache dizinin olmuş olur.
__________________
Forum Reklam Site Reklam
Alıntı ile Cevapla

Cevapla

Seçenekler
Stil


Benzer Konular
Konu Konuyu Başlatan Forum Cevaplar Son Mesaj
plesk te bir klasörü back up nasıl alırım. Mywedding Kontrol Panelleri 11 2007-03-26 15:26
ie download sayısını arttırma draligus Internet Explorer 6 2006-03-04 08:11
Con klasörü? caper Güncel Konular Haberler 8 2005-12-15 20:48


Bütün Zaman Ayarları WEZ +2 olarak düzenlenmiştir. Şu Anki Saat: 13:10 .


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0

Firefox