This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
require_once "php_cache.php"; | |
echo 123456; | |
phpinfo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `data_index` ( | |
`id` int(11) NOT NULL, | |
`num` smallint(6) NOT NULL, | |
`word` varchar(33) DEFAULT NULL, | |
PRIMARY KEY (`id`,`num`), | |
KEY `word` (`word`,`id`), | |
KEY `id` (`id`,`word`) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$r = new Redis(); | |
$r->connect($redis_ip, $redis_port); | |
$data = $r->sort("all:srv", array( | |
"get" => array("srv:*->port", "srv:*->mem" ) | |
) | |
); | |
print_r(redis_transpose_sort($data, array("port", "mem") ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/* | |
========================= | |
Memcached 2 Redis wrapper | |
========================= | |
Version 1.0.1, CopyLeft 2011.AUG.11 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/* | |
This is server written in PHP that employ socket select() method. | |
It is single threaded and does not fork, but rather process the clients "very" fast one by one. | |
Redis, nginx and Lighttpd works in similar way. | |
This source was found on the net, but I did lots of changes in order to get it work. | |
To make things simple, server is changed to be echo server, it simply print back what you send. | |
After starting the file, you should do: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/* | |
Bozo Sort written in PHP | |
Nikolay Mihaylov Copyleft 2012-03-28, Sofia | |
*/ | |
function is_sorted($a){ | |
for($i=0; $i < count($a) - 1; $i++) | |
if ($a[$i] > $a[$i + 1]) | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
function shell_sort($a){ | |
$step = count($a) - 1; | |
while ( true ){ | |
$sorted = false; | |
echo sprintf("Step %3d\n", $step); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
require_once(__DIR__.'/../lib/autoload.php'); | |
use phpcassa\SystemManager; | |
use phpcassa\Connection\ConnectionPool; | |
use phpcassa\ColumnFamily; | |
use phpcassa\Index\IndexExpression; | |
use phpcassa\Index\IndexClause; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!/usr/local/bin/php | |
<? | |
require_once(__DIR__.'/../lib/autoload.php'); | |
use phpcassa\Connection\ConnectionPool; | |
if ($argc < 2){ | |
echo "Usage {$argv[0]} keyspace cql\n"; | |
exit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server1: | |
[default@DEMO] set x[abc][1] = 5; | |
Value inserted. | |
Elapsed time: 1 msec(s). | |
server2: | |
[default@DEMO] set x[abc][2] = 6; | |
Value inserted. |
OlderNewer