예제 #1
0
 *    TinyGojira
 * 
 *    Copyright (C) 2009 Adam Venturella
 *
 *    LICENSE:
 *
 *    Licensed under the Apache License, Version 2.0 (the "License"); you may not
 *    use this file except in compliance with the License.  You may obtain a copy
 *    of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
 *    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 *    PURPOSE. See the License for the specific language governing permissions and
 *    limitations under the License.
 *
 *    Author: Adam Venturella - aventurella@gmail.com
 *
 *    @package Sample 
 *    @author Adam Venturella <*****@*****.**>
 *    @copyright Copyright (C) 2009 Adam Venturella
 *    @license http://www.apache.org/licenses/LICENSE-2.0 Apache 2.0
 *
 **/
/**
 * Sample
 */
require 'tinygojira/TinyGojira.php';
$db = new TinyGojira();
echo "Database status: " . $db->stat();
예제 #2
0
 *    Licensed under the Apache License, Version 2.0 (the "License"); you may not
 *    use this file except in compliance with the License.  You may obtain a copy
 *    of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
 *    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 *    PURPOSE. See the License for the specific language governing permissions and
 *    limitations under the License.
 *
 *    Author: Adam Venturella - aventurella@gmail.com
 *
 *    @package Sample 
 *    @author Adam Venturella <*****@*****.**>
 *    @copyright Copyright (C) 2009 Adam Venturella
 *    @license http://www.apache.org/licenses/LICENSE-2.0 Apache 2.0
 *
 **/
/**
 * Sample
 */
require 'tinygojira/TinyGojira.php';
// assuming the samples/put/put_general.php happened first:
$data = false;
$db = new TinyGojira();
$data = $db->get('tinygojira');
if ($data) {
    $result = json_decode($data, true);
    print_r($result);
}
예제 #3
0
 *    PURPOSE. See the License for the specific language governing permissions and
 *    limitations under the License.
 *
 *    Author: Adam Venturella - aventurella@gmail.com
 *
 *    @package Sample 
 *    @author Adam Venturella <*****@*****.**>
 *    @copyright Copyright (C) 2009 Adam Venturella
 *    @license http://www.apache.org/licenses/LICENSE-2.0 Apache 2.0
 *
 **/
/**
 * Sample
 */
require 'tinygojira/TinyGojira.php';
$db = new TinyGojira();
$db->put('monster:Godzilla', 'Monster1');
$db->put('monster:Mothra', 'Monster2');
$db->put('robot:Gigantor', 'Robot1');
$db->put('monster:Gamera', 'Monster3');
$db->put('monster:Megalon', 'Monster4');
$db->put('robot:Voltron', 'Robot2');
?>

<h1>All Monster Keys</h1>
<?php 
echo "<pre>" . print_r($db->fwmkeys('monster:'), true) . "</pre>";
?>
<h1>2 Monster Keys</h1>
<?php 
echo "<pre>" . print_r($db->fwmkeys('monster:', 2), true) . "</pre>";
예제 #4
0
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
 *    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 *    PURPOSE. See the License for the specific language governing permissions and
 *    limitations under the License.
 *
 *    Author: Adam Venturella - aventurella@gmail.com
 *
 *    @package Sample 
 *    @author Adam Venturella <*****@*****.**>
 *    @copyright Copyright (C) 2009 Adam Venturella
 *    @license http://www.apache.org/licenses/LICENSE-2.0 Apache 2.0
 *
 **/
/**
 * Sample
 */
require 'tinygojira/TinyGojira.php';
$db = new TinyGojira();
$data = null;
$db->put('Godzilla', 'Monster1');
$db->put('Mothra', 'Monster2');
$db->put('Gamera', 'Monster3');
$db->put('Megalon', 'Monster4');
$keys = array('Mothra', 'Godzilla', 'Megalon');
$data = $db->mget($keys);
if ($data) {
    print_r($data);
}
예제 #5
0
 *
 *    Licensed under the Apache License, Version 2.0 (the "License"); you may not
 *    use this file except in compliance with the License.  You may obtain a copy
 *    of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
 *    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 *    PURPOSE. See the License for the specific language governing permissions and
 *    limitations under the License.
 *
 *    Author: Adam Venturella - aventurella@gmail.com
 *
 *    @package Sample 
 *    @author Adam Venturella <*****@*****.**>
 *    @copyright Copyright (C) 2009 Adam Venturella
 *    @license http://www.apache.org/licenses/LICENSE-2.0 Apache 2.0
 *
 **/
/**
 * Sample
 */
require 'tinygojira/TinyGojira.php';
$db = new TinyGojira();
$db->put('Godzilla', 'One Rocking Monster!');
echo $db->get('Godzilla') . "<br>";
// One Rocking Monster!
$db->putkeep('Godzilla', 'One Super Lame Monster!');
echo $db->get('Godzilla');
// One Rocking Monster!
예제 #6
0
 *    TinyGojira
 * 
 *    Copyright (C) 2009 Adam Venturella
 *
 *    LICENSE:
 *
 *    Licensed under the Apache License, Version 2.0 (the "License"); you may not
 *    use this file except in compliance with the License.  You may obtain a copy
 *    of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
 *    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 *    PURPOSE. See the License for the specific language governing permissions and
 *    limitations under the License.
 *
 *    Author: Adam Venturella - aventurella@gmail.com
 *
 *    @package Sample 
 *    @author Adam Venturella <*****@*****.**>
 *    @copyright Copyright (C) 2009 Adam Venturella
 *    @license http://www.apache.org/licenses/LICENSE-2.0 Apache 2.0
 *
 **/
/**
 * Sample
 */
require 'tinygojira/TinyGojira.php';
$db = new TinyGojira();
echo "Number of records in the cabinet: " . $db->rnum();
예제 #7
0
 *    use this file except in compliance with the License.  You may obtain a copy
 *    of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
 *    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 *    PURPOSE. See the License for the specific language governing permissions and
 *    limitations under the License.
 *
 *    Author: Adam Venturella - aventurella@gmail.com
 *
 *    @package Sample 
 *    @author Adam Venturella <*****@*****.**>
 *    @copyright Copyright (C) 2009 Adam Venturella
 *    @license http://www.apache.org/licenses/LICENSE-2.0 Apache 2.0
 *
 **/
/**
 * Sample
 */
require 'tinygojira/TinyGojira.php';
$db = new TinyGojira();
$object = new stdClass();
// could also use array[]
$object->email = "*****@*****.**";
$object->password = hash('sha1', 'tinygojira');
$data = json_encode($object);
if ($db->put('tinygojira', $data)) {
    echo 'Successfully written!';
}
예제 #8
0
 *
 *    Licensed under the Apache License, Version 2.0 (the "License"); you may not
 *    use this file except in compliance with the License.  You may obtain a copy
 *    of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
 *    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 *    PURPOSE. See the License for the specific language governing permissions and
 *    limitations under the License.
 *
 *    Author: Adam Venturella - aventurella@gmail.com
 *
 *    @package Sample 
 *    @author Adam Venturella <*****@*****.**>
 *    @copyright Copyright (C) 2009 Adam Venturella
 *    @license http://www.apache.org/licenses/LICENSE-2.0 Apache 2.0
 *
 **/
/**
 * Sample
 */
require 'tinygojira/TinyGojira.php';
$db = new TinyGojira();
$db->put('Godzilla', 'Hello123456789');
echo $db->get('Godzilla') . "<br>";
// Hello123456789
$db->putshl('Godzilla', 'World', 14);
echo $db->get('Godzilla');
// 123456789World
예제 #9
0
<?php

require 'tinygojira/TinyGojira.php';
$gojira = new TinyGojira();
//echo $gojira->vsiz('pogo1');
/*for($i = 0; $i < 200000; $i++)
{
	$gojira->put('pogo'.$i, 'cat'.$i);
}
*/
/*$gojira->putkeep('Pogo1', 'cat1') ? 'success' : 'error';
$gojira->putkeep('Pogo2', 'cat2') ? 'success' : 'error';
$gojira->putkeep('Pogo3', 'cat3') ? 'success' : 'error';
$gojira->putkeep('Pogo4', 'cat4') ? 'success' : 'error';
$gojira->putkeep('Pogo5', 'cat5') ? 'success' : 'error';
$gojira->putkeep('Pogo6', 'cat6') ? 'success' : 'error';
$gojira->putkeep('Pogo7', 'cat7') ? 'success' : 'error';
*/
//$gojira->put('GH5Like', 1);
//$gojira->mget(array('Pogo3', 'Pogo1', 'Pogo6'));
//$gojira->fwmkeys('Pogo', 7);
//echo $gojira->putnr('Pogo6', 'CatzManDu!!') ? 'success' : 'error';
//echo "<br>";
/*
$data = $gojira->get('Pogo5');
echo $data === false ? 'error' : $data;
echo "<br>";

echo $gojira->out('Pogo5') ? 'deleted' : 'error';
echo "<br>";
*/
예제 #10
0
 *    TinyGojira
 * 
 *    Copyright (C) 2009 Adam Venturella
 *
 *    LICENSE:
 *
 *    Licensed under the Apache License, Version 2.0 (the "License"); you may not
 *    use this file except in compliance with the License.  You may obtain a copy
 *    of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
 *    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 *    PURPOSE. See the License for the specific language governing permissions and
 *    limitations under the License.
 *
 *    Author: Adam Venturella - aventurella@gmail.com
 *
 *    @package Sample 
 *    @author Adam Venturella <*****@*****.**>
 *    @copyright Copyright (C) 2009 Adam Venturella
 *    @license http://www.apache.org/licenses/LICENSE-2.0 Apache 2.0
 *
 **/
/**
 * Sample
 */
require 'tinygojira/TinyGojira.php';
$db = new TinyGojira();
echo "How big is the cabinet? " . $db->size();
예제 #11
0
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
 *    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 *    PURPOSE. See the License for the specific language governing permissions and
 *    limitations under the License.
 *
 *    Author: Adam Venturella - aventurella@gmail.com
 *
 *    @package Sample 
 *    @author Adam Venturella <*****@*****.**>
 *    @copyright Copyright (C) 2009 Adam Venturella
 *    @license http://www.apache.org/licenses/LICENSE-2.0 Apache 2.0
 *
 **/
/**
 * Sample
 */
require 'tinygojira/TinyGojira.php';
// assuming starting with an empty database
$db = new TinyGojira();
$db->put('Godzilla', 'Monster1');
$db->put('Mothra', 'Monster2');
$db->put('Gamera', 'Monster3');
$db->put('Megalon', 'Monster4');
echo "Records Before Vanish: " . $db->rnum() . "<br>";
// 4
$db->vanish();
echo "Records After Vanish: " . $db->rnum();
// 0
예제 #12
0
 *
 *    Licensed under the Apache License, Version 2.0 (the "License"); you may not
 *    use this file except in compliance with the License.  You may obtain a copy
 *    of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
 *    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 *    PURPOSE. See the License for the specific language governing permissions and
 *    limitations under the License.
 *
 *    Author: Adam Venturella - aventurella@gmail.com
 *
 *    @package Sample 
 *    @author Adam Venturella <*****@*****.**>
 *    @copyright Copyright (C) 2009 Adam Venturella
 *    @license http://www.apache.org/licenses/LICENSE-2.0 Apache 2.0
 *
 **/
/**
 * Sample
 */
require 'tinygojira/TinyGojira.php';
$db = new TinyGojira();
$db->put('Godzilla', 'Hola, ');
echo $db->get('Godzilla') . "<br>";
// Hola,
$db->putcat('Godzilla', 'mi nombre es Godzilla!');
echo $db->get('Godzilla');
// Hola, mi nombre es Godzilla!