Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- memcache->flush() --SKIPIF-- <?php include 'connect.inc'; ?> --FILE-- <?php // T..

Decoded Output download

--TEST--
memcache->flush()
--SKIPIF--
<?php include 'connect.inc'; ?>
--FILE--
<?php

// This test must be run last or some concurrency problems will occur
// since the "flush_all" seems to be done async and therefore will 
// affect subsequent calls to set() done with a second or so.

include 'connect.inc';

// Test flush in future
$memcache = new Memcache();
$memcache->addServer($host, $port);

$result1 = $memcache->set('test_key', 'abc');
$result2 = $memcache->get('test_key');
var_dump($result1);
var_dump($result2);

$result = $memcache->flush(time()+3);
var_dump($result);

sleep(1);

$result = $memcache->get('test_key');
var_dump($result);

sleep(2);

$result = $memcache->get('test_key');
var_dump($result);

// Test partly failing flush
$memcache = new Memcache();
$memcache->addServer($host, $port);
$memcache->addServer($nonExistingHost, $nonExistingPort);

$result = @$memcache->flush();
var_dump($result);

// Test failing flush
$memcache = new Memcache();
$memcache->addServer($nonExistingHost, $nonExistingPort);

$result = @$memcache->flush();
var_dump($result);

?>
--EXPECT--
bool(true)
string(3) "abc"
bool(true)
string(3) "abc"
bool(false)
bool(true)
bool(false)

Did this file decode correctly?

Original Code

--TEST--
memcache->flush()
--SKIPIF--
<?php include 'connect.inc'; ?>
--FILE--
<?php

// This test must be run last or some concurrency problems will occur
// since the "flush_all" seems to be done async and therefore will 
// affect subsequent calls to set() done with a second or so.

include 'connect.inc';

// Test flush in future
$memcache = new Memcache();
$memcache->addServer($host, $port);

$result1 = $memcache->set('test_key', 'abc');
$result2 = $memcache->get('test_key');
var_dump($result1);
var_dump($result2);

$result = $memcache->flush(time()+3);
var_dump($result);

sleep(1);

$result = $memcache->get('test_key');
var_dump($result);

sleep(2);

$result = $memcache->get('test_key');
var_dump($result);

// Test partly failing flush
$memcache = new Memcache();
$memcache->addServer($host, $port);
$memcache->addServer($nonExistingHost, $nonExistingPort);

$result = @$memcache->flush();
var_dump($result);

// Test failing flush
$memcache = new Memcache();
$memcache->addServer($nonExistingHost, $nonExistingPort);

$result = @$memcache->flush();
var_dump($result);

?>
--EXPECT--
bool(true)
string(3) "abc"
bool(true)
string(3) "abc"
bool(false)
bool(true)
bool(false)

Function Calls

None

Variables

None

Stats

MD5 8551ca9524966ef0af62e464e2b9e72a
Eval Count 0
Decode Time 88 ms