发布于 2017-03-15 02:16:43 | 152 次阅读 | 评论: 0 | 来源: 网友投递
Phalcon开源PHP框架
PhalconPHP 是一个使用 C 扩展开发的 PHP Web 框架,提供高性能和低资源占用。
使用 WiredTigger 实现本地存储,用作数据缓存。在本地测试每秒可以达到10万的插入(CPU:Intel(R) Xeon(R) CPU E5-2403 0 @ 1.80GHz、Memory:8GB)
$db = new PhalconStorageWiredtiger('unit-tests/cache/wiredtiger'); $this->assertTrue($db->create('table:phalcon_test')); $cursor = $db->open('table:phalcon_test'); $this->assertTrue($cursor->set("key1", "value1")); $this->assertTrue($cursor->set("key2", "value2")); $this->assertEquals($cursor->get("key1"), "value1"); $this->assertEquals($cursor->get("key2"), "value2"); $this->assertEquals($cursor->gets(array("key1", "key2")), array("value1", "value2")); $this->assertTrue($cursor->delete("key1")); $this->assertEquals($cursor->get("key1"), NULL); foreach ($cursor as $key => $val) { $this->assertEquals($key, 'key2'); $this->assertEquals($val, 'value2'); }
查询参数支持绑定数组:
$songs = $manager->executeQuery('SELECT * FROM Songs WHERE id NOT IN (:id:)', array('id' => array(1,2,3,4)));