Jump to content
Larry Ullman's Book Forums

Cfilecache


Jonathon
 Share

Recommended Posts

Hello Jonathon. I haven't done hard tests myself, but I'd recommend you give it a try (hard tests for performance). On the one hand, file system stuff is SO much slower than memory. On the other hand, will using a cached version from the file be faster than generating it all yourself? 

 

As I said, tests are the only true way to know, but I'd be inclined to only use file caching for rendered stuff (complete pages, significant snippets), and not use it for data management. 

Link to comment
Share on other sites

Hey Jonathon, whats up? Are you still on target to completing your project by year end or january?

 

I am starting to get it worked out with my project how it will work and with the code the trouble is i will have to go back and recode parts as now i am much better than when i started out. I wasn't like you, i didn't have any experience of HTML, CSS and PHP i basically just started out on Yii after reading Larry's book. However taking this root it is still working out and i reckon i am learning it all much faster than just bashing at PHP alone.

 

Ive decided to cut down some other things now and spend at least 5 full days a week on my project, the amount of coding that needs to be done is just massive if i didn't use Yii the task would of just been impossible (thanks to the german that advised me to use a framework). The thing is with Yii I always learn something new everytime i use it.

 

I can't put the time on when i will finish my project i really don't know because every thing looks easy but there is also much more detail that comes out of parts than i originally thought. It could be in this year, it could be 2015, or it could be early 2016. However no matter what i come across or how hard it is i will get it done.

 

Your Friend Edward,

Link to comment
Share on other sites

Thanks Larry,

 

Hi Edward,

 

I got most of it done, I need to add a way to accept payments and a decent way to search. I think Larry aims to cover these in his Yii book. So when they come out i'll tinker away. They are the main things I need to get done, then I suppose, lots of testing and sorting out of smaller things.

Link to comment
Share on other sites

That's a good idea, are you a marketplace for different virtual products or selling your own individual bunch of virtual products? This will be my last question.

 

By the way, i removed the yii-booster extension from my site and added Bootstrap 3 instead because generally it was more useful than the old one, the sizeable input were good for me and saved me doing separate css. But those flat buttons they just make the website look terrible, beveled were really the best. Im going to definitly need to add some new color styles for those buttons or possibly get the beveled one back in.

Link to comment
Share on other sites

Well i hope it will work out well for you, its an interesting idea to follow up on. I am building a basic marketplace for regular goods of any kind, may be i could add a category for virtual products so you can link your website. Once i get it build i will see what the options are.

 

Have a merry christmas Jonathon!

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...

Hi Larry,

 

I want to cache my index.php page. I've configured the main.php with declaration in cache component as CFileCache.

 

I want to cache my search engine in the index page. In the Site Controller I've added:

 

$property = false;
if($cache = Yii::app()->cache!== null)
{
if(isset($_POST['location'] && isset($_GET['prop_search'])) // (location is the search engine name and prop_search is search button's  id which is a submit button.)
{
$val = explode(',',$_POST['location']);
$value = 'SELECT * FROM cache_search where keyword like "%".$val."%"';
$command = YII::app()->db->createCommand($value);
$result = $command->queryAll();
Yii::app()->cache->get($result);
}}
else{
$key = md5(rand(10,10000));
Yii::app()->cache->set($key,$result,0);
}
if(!$property)
{
$sql = 'SELECT property_id,property_name,keyword FROM cache_search';
$command = YII::app()->db->createCommand($sql);
$property = $command->queryAll();
if(isset($key))
$cache->get($key, $property, 0);
}
 
I'm getting the value of the data stored in the cache_search table in the database but not the new searched keywords in the table. nor even in the view. I've not added anything to view. I'm confused cause this page is not having any models. it's having index.php as view and siteController only.
 
Please help me getting  it. I'm stuck with it for a week long but yet not been able to fix it.
Link to comment
Share on other sites

I'm confused by what you're trying to do here. You want to cache your search engine? That's pretty unorthodox as far as I know. What are the odds of two people searching using the exact same terms (caching is beneficial when there's multiple of the same request)?

Link to comment
Share on other sites

 Share

×
×
  • Create New...