Sure. The code is like this:

$mch = memcache_connect('chongstorage1', 11211); // error log warning occurs
here

if ($mch)
{
    $result = $mch->get('news:1234');

    if (!$result)
    {
        $result = $dbh->sql('select * from news where news_id=1234');

        if ($mch->get('news:1234')
        {
            $mch->replace('news:1234', $result);
        }
        else
        {
            $mch->set('news:1234', $result);
        }
    }

    return $result;
}
else
{
    // do memcache connect again, but error_log still spits out the same
error
}


On 29/02/2008, sir buce <[EMAIL PROTECTED]> wrote:
>
> Can you send any example to see how you are make the conection and the key
> storage?
>
> 2008/2/28, Jonathan Chong <[EMAIL PROTECTED]>:
> >
> > Hello
> >
> > Yes, memcache is compiled with PHP, and I can retrieve memcache values.
> >
> > Any other ideas?
> >
> > Thanks.
> >
> >
> > On 28/02/2008, sir buce <[EMAIL PROTECTED]> wrote:
> > >
> > > Do you have installed memcached module for php?
> > >
> > > This module you can install from repositories with php5-memcache
> > > package or the best idea is to install the latest memcached pecl for
> > > memcached.
> > >
> > > http://pecl.php.net/package/memcache
> > >
> > > If you install the php5-memcache package your php.ini will be
> > > configure automatically, the other way you need to put in your php.ini
> > > :
> > >
> > > extension = memcache.so
> > >
> > >
> > > Regards,
> > >
> > > 2008/2/27, Jonathan Chong <[EMAIL PROTECTED]>:
> > > >
> > > > Hi all
> > > >
> > > > I'm getting a weird error in my error logs in relation to memcache.
> > > > I've tried googling for solutions but none of the sites I looked at 
> > > > provided
> > > > an explanation or resolution, so to the mailing list I come.
> > > >
> > > > The error in the logs are as follows:
> > > >
> > > > PHP Warning:  memcache_connect() [<a href='function.memcache-connect
> > > > '>function.memcache-connect</a>]: Can't connect to
> > > > chongstorage1:11211, Unknown error (0) in /home/Core/Memcache.php on 
> > > > line 29
> > > >
> > > > This only happens at random, and not all the time.
> > > >
> > > > I can telnet into chongstorage1 on the default port (this is the
> > > > machine that is running the daemon). I've tried flushing memcached,  but
> > > > it's not related to the amount of items (memcached has a hard-coded 
> > > > limit).
> > > >
> > > > DNS is fine, either machines can ping each other and even if I run
> > > > memcached on the local machine the error persists.
> > > >
> > > > I've tried upgrading PHP, Apache, memcache and memcached but the
> > > > error is still there.
> > > >
> > > > Any ideas?
> > > >
> > > > Happy to provide more information where possible.
> > > >
> > > > Thanks.
> > > >
> > > > --
> > > > Jonathan Chong
> > > >
> > > > http://jonathanchong.com/
> > > > http://arsenal-mania.com/
> > >
> > >
> > >
> >
> >
> > --
> > Jonathan Chong
> >
> > http://jonathanchong.com/
> > http://arsenal-mania.com/
> >
>
>


-- 
Jonathan Chong

http://jonathanchong.com/
http://arsenal-mania.com/

Reply via email to