Jump to content

Recommended Posts

Hi there, I've been looking around for the answer, or just even advice on if this is a good idea before I actually do it.

 

I want to write a social script that has a live feed like facebook, etc. I don't want to have to call to the main database for fetching the recent items as it will load quite often through AJAX and this could create some problems, I think.

 

I want to know if it's a good idea to use the MEMORY engine to cache recent items. (certain things will be cached in PHP variables.)

If it is, how long is an ideal lifetime for cached items? I'm planning on having a sitewide feed (there aren't very many members yet) and a per-user feed that displays on their profile.

If I do use the MEMORY engine, I plan on after a certain amount of time, or a certain amount of recent entries per user, the older entries will be moved to the main database and stored on the server in an xml file. These recent entries will either be for JIT xml or JSON encoded files so that they can load much faster.

 

Is there any problems this could cause down the road?

Would I just be better off using a file stream instead?

I've considered a few options, this one seems ideal as I can keep it an ideal size using crontab and minimal coding.

Link to comment
https://forums.phpfreaks.com/topic/203660-memory-engine-as-a-cache-for-feeds/
Share on other sites

  • 2 months later...

Sheesh. I've been very busy so apologies for the delayed response.

 

The point in using MEMORY over HTML pages is that each feed is different for each user, so I would need an engine that is somewhat faster. I know that using a database is faster than file writing as writing files has a larger overhead as opposed to calling a database. MySQL, for instance, stores it's data in files on the hard disk and calls loads things from that data file. The objective of using the MEMORY engine would be that the data is in the RAM of my box and can be served faster than being called off of the disk.

 

I'm not disagreeing or anything, I'm just curious as to what performance factors the MEMORY engine has with speed, etc. I've also looked at the InnoDB engine and I believe that it does store the data file right on the memory, so using that would be more ideal than MyISAM in my case. (I have lots of memory.) I'm still not sure what the purpose of using the MEMORY engine is, though.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.