dmntnk benden önce davranmış bende paylaşayım
<?php
if(defined("security")) or die ("fuck you");
class cache
    {
    private $Error = array();
    public  function cache_get($name)
                {
                if ($this->cache_isset($name)):
                    return xcache_get($name);
                else:
                $this->Error[] = $name.' Adında Bir Cache Yok!';
                return $this->Error;
            endif;
    }
        public function cache_set($tables,$data)
        {
            if(xcache_set($tables,$data)):
                return true;
            else:
                $this->Error[] = 'Cache\'leme Başarısız';
                return $this->Error;
            endif;
        }
        public function cache_isset($cache_name)
        {
            if(xcache_isset($cache_name)):
                return true;
            else:
                $this->Error[] = "$cache_name Adında Bir Cache Bulunamadı";
                    return $this->Error;
            endif;
        }
            public function cache_unset()
            {
                if($this->cache_isset($name)):
                    cache_unset($name);
                else:
                    $this->Error[] = $name.' Silinemiyor Çünkü Böyle Bir Cache Yok!';
                    return false;
               endif;
            }
        public function Error()
        {
            foreach($this->Error as $error):
            echo "<li>$error</li>\n";
            endforeach;
        }
}
$cache = new cache();
$Sql = mysql_query("SELECT username,password,register_date from users");
while($Print=mysql_fetch_assoc($Sql)):
$Cache["username"][]      = $Print["username"];
$Cache["password"][]      = $Print["password"];
$Cache["register_date"][] = $Print["register_date"];
endwhile;
/*
*cacheleme
*/
if($cache->cache_set("users_cache",serialize($Cache))):
echo "Cacheleme Başarılı";
endif;
/*
*cache okuma
*/
if($cache->cache_isset()):
$cache = unserialize($cache->cache_get('users_cache'));
echo "<pre>";
print_r($cache);
echo "</pre>";
endif;

/*
*cache silme
*/
$cache->cache_unset("users_cache");


/*
*Hatalar
*/
$cache->Error();
?>