Can I use memcached as a Database

Junaid N. Sahibzada sjunaidn at yahoo.com
Tue Sep 26 00:09:45 UTC 2006


Hi All,

I have several questions regarding memcached.

The first question is that how do i append extra data at the end of the cache.

I have been using the function set to add items to the cache.

But some how i have been unable to use the function add to add items to the cache.

Here is my code in PHP


class clsMem extends Memcache
     {
        
            static private $m_objMem = NULL;
            
                static function getMem()
                 {
            
                        if (self::$m_objMem == NULL)
                
                            {
                                
                                self::$m_objMem = new Memcache;
                                self::$m_objMem->connect('localhost', 11211) or die ("The memcached server");
                                
                            }
                        return self::$m_objMem;
                  }
     }

     
     
$URLarray = array( '1'=>array('yahoo.com','Yes'),
                   '2'=>array('hotmail.com','Yes'),
                   '3'=>array('cnn.com', 'No'),
                   '4'=>array('bbc.co.uk','Yes'),
                   '5'=>array('pctool.com','Yes'),);
                   
clsMem::getMem()->set("URL", serialize($URLarray), true, 600) or die ("Could not write to the cache");    


 Now if i have another item to add to the cache, how do i add it to the cache?

2. I would basically want to have a database of URLS in my main memory which i can quickly query, index, update, delete and modify.

Is this possible with memcache?   


                          Junaid N. Sahibzada
  Cell # (+61) 404 998 494 
    Student MSc Internetworking, UTS, Australia
  Bachelor of Information Technology, NUST, Pakistan














 		
---------------------------------
Do you Yahoo!?
 Get on board. You're invited to try the new Yahoo! Mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.danga.com/pipermail/memcached/attachments/20060925/2bff1d48/attachment.html


More information about the memcached mailing list