Пример #1
0
 *    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>";
?>
Пример #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';
$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!
Пример #3
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);
}
Пример #4
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!';
}
Пример #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', 'Hello123456789');
echo $db->get('Godzilla') . "<br>";
// Hello123456789
$db->putshl('Godzilla', 'World', 14);
echo $db->get('Godzilla');
// 123456789World
Пример #6
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!