Thanks for your reply!
I updated the function test(), but still got the same output.
--------------------------------
sub test()
{
    my $number = $_[0];

    select(undef, undef, undef, 1);
    print "====== Now set key[$number] --> value[aaa]\n";
    if( ! $cache->set( $number, "aaa" ) ) {
        print "Set Error \n";
    }

    select(undef, undef, undef, 1);
    print "Now try to get value of key[$number] ...";
    my $sss = $cache->get( $number );
    if( !defined( $sss ) ) {
        print "Cache get Error. Value [$sss]\n";
    } else {
        print "Cache get OK. Value [$sss]\n";
    }
}
-------------------------
It's really a strange problem to me now, blocking my further test.
Thanks!


On 12月9日, 上午1时34分, Brian Moon <[email protected]> wrote:
> If you place a usleep(500) between the set and get does it still error out?
>
> Brian.
> --------http://brian.moonspot.net/
>
> On 12/8/09 3:42 AM, liangasdf wrote:
>
>
>
> > Codes:
> > ---------
> >> cat aa.pl
> > #!/opt/csw/bin/perl
>
> > use Cache::Memcached;
>
> > my $cache = new Cache::Memcached {
> >      'servers' =>  [ "172.25.242.123:11211" ],
> > };
>
> > test( "1234" );
> > test( "12345" );
> > test( "aaaaa" );
> > test( "123456" );
> > test( "1234567" );
> > test( "12345678" );
> > test( "123456789" );
> > test( "1234567890" );
>
> > sub test()
> > {
> >      my $number = $_[0];
>
> >      print "====== Now set key[$number] -->  value[aaa]\n";
> >      if( ! $cache->set( $number, "aaa" ) ) {
> >          print "Set Error \n";
> >      }
>
> >      print "Now try to get value of key[$number] ...";
> >      my $sss = $cache->get( $number );
> >      if( !defined( $sss ) ) {
> >          print "Cache get Error. Value [$sss]\n";
> >      } else {
> >          print "Cache get OK. Value [$sss]\n";
> >      }
> > }
>
> > But some of the keys are failed to operated.
> >> ./aa.pl
> > ====== Now set key[1234] -->  value[aaa]
> > Now try to get value of key[1234] ...Cache get OK. Value [aaa]
> > ====== Now set key[12345] -->  value[aaa]
> > Now try to get value of key[12345] ...Cache get Error. Value []
> > ====== Now set key[aaaaa] -->  value[aaa]
> > Now try to get value of key[aaaaa] ...Cache get Error. Value []
> > ====== Now set key[123456] -->  value[aaa]
> > Now try to get value of key[123456] ...Cache get Error. Value []
> > ====== Now set key[1234567] -->  value[aaa]
> > Now try to get value of key[1234567] ...Cache get OK. Value [aaa]
> > ====== Now set key[12345678] -->  value[aaa]
> > Now try to get value of key[12345678] ...Cache get OK. Value [aaa]
> > ====== Now set key[123456789] -->  value[aaa]
> > Now try to get value of key[123456789] ...Cache get Error. Value []
> > ====== Now set key[1234567890] -->  value[aaa]
> > Now try to get value of key[1234567890] ...Cache get Error. Value []
>
> > Need help! Thanks a lot!!!- 隐藏被引用文字 -
>
> - 显示引用的文字 -

Reply via email to