Issue
I am doing a project using MVC architecture. I am maintaining all the values in session. One of my senior developer tell me that it is not a right procedure to do and he suggest me store all the values in cache.
Is he right? If yes, how can I do that using php...
Solution
Memcache is not the answer for everything, but can dramatically increase page loads for web applications that have lots of load.
The concept is to store your data as key-value pairs in memory (a memcache) and retrieve the data using a key whenever necessary.
Here is a quick example of setting and retrieving data from memcache in PHP:
$memcache = new Memcache;
$memcache->connect('192.168.1.2', 11211) or die ("Unable to connect");
$memcache->set(‘key1’, 'value1'); // Set some data
$memcache->get('key1'); // Get some data
Read up on some of this:
http://papermashup.com/using-memcache-with-php/
http://fschiettecatte.wordpress.com/2008/05/15/to-use-or-not-to-use-memcached-that-is-the-question/
http://www.majordojo.com/2007/03/memcached-howto.php
Good luck, let me know if you have any more questions
Answered By - Philoxopher Answer Checked By - Candace Johnson (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.