Skip to content

Instantly share code, notes, and snippets.

@nagaho
Created September 2, 2018 07:55
Show Gist options
  • Save nagaho/b62f6be070674fc8aec645b0cd5bc09b to your computer and use it in GitHub Desktop.
Save nagaho/b62f6be070674fc8aec645b0cd5bc09b to your computer and use it in GitHub Desktop.
#!/usr/bin/env php
<?php
$di = new Phalcon\Di();
$di->set('db', function () {
return new Phalcon\Db\Adapter\Pdo\Mysql(
['host' => 'localhost', 'username' => 'root', 'password' => 'pass', 'dbname' => 'test']
);
});
$di->set('modelsMetadata', Phalcon\Mvc\Model\Metadata\Memory::class);
$di->set('modelsManager', Phalcon\Mvc\Model\Manager::class);
$user = new User();
$user->id = mt_rand(1, 10);
$user->name = uniqid();
$user->create();
class User extends Phalcon\Mvc\Model
{
public function initialize()
{
$this->setSource('users');
}
}
@nagaho
Copy link
Author

nagaho commented Sep 2, 2018

$ parallel --no-notice ./phalcon_create_update_test.php ::: {01..100}
...

$ tail -f /tmp/query.log | grep UPDATE 
2018-09-02T07:39:00.965470Z      9296 Query     UPDATE `users` SET `name` = '5b8b9394e7a1d' WHERE `id` = 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment