<?php /* * test file for ocache class * */
#get the class include 'ocache.php';
#initiate it $cache = new ocache('cache');
#or # $cache = new ocache('cacheFolder', 'apc'); #or # after initiate the class you can specify the cache folder and type of caching # # type of caching can be files or depending on APC: # # $cache->dir_path = 'whatever'; # $cache->type = 'APC';
if(($cached_data = $cache->get('stuff_names')) === false){ #echo 'test:1'; #here you can get stuff from mysql database and .. save it to cache $cached_data = array('name1' => 'Abdul', 'name2'=>'Muhammad', 'name3'=>'Osama'); #save it, using default type of caching or APC $cache->save('stuff_names', $cached_data, 3600); # 3600 is seconds }
#NOW use it print_r($cached_data);
|